-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find package 'next' imported from /var/task/index.mjs" #169
Comments
Hi @sonnydg, can you provide a minimal reproducible repo? |
@bestickley use this example: What I see is that deploying cdk in Windows gives those errors that I understand may be due to the folders and path, in Ubuntu doing a deployment with cdk works without problem. |
Not in this case, that error (which I solved in my locale) means that you cannot do the deploy, in this case it is already deployed and when viewing the domain it shows the error: The way I could solve it is, this line and archive
This would solve the error previously, from what I understand is that the problem comes with the bucket to deploy the asset. then there is another error that is from nextJS here is issue in next: and from here I moved to Linux to be able to move forward more fluidly. |
Are you recommending a change from |
I recommend using formAsset because the CDK is compatible with any system that is deployed, it is responsible for packaging and uploading by cloudformation in the lambda that the source needs, this is done "natively" so I understand that it is not applied this way by some reason and I would need to understand why it is with fromBucket. Looking at the code a little, I understand that it is like this to be able to replace some parameters in the code from lambda and then upload the source to the lambda server. Why is it necessary to perform such action having environment variable by lambda and aws SDK? I don't know. |
@sonnydg, I understand your confusion. I wish we could use |
@bestickley https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs.NodejsFunctionProps.html#depslockfilepath https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs.NodejsFunctionProps.html#projectroot
|
@sonnydg, I tried to get this to work with native CDK for 2 weeks and could not. If you can get it to work that would be awesome. I would happily accept a PR. |
@bestickley https://nextjs.org/docs/pages/api-reference/next-config-js/output#caveats |
What open-next does applies to the project in Next, so this configuration is valid to carry out without problems. I used outputFileTracingRoot incorrectly and when deploying the URL it did not work it gave an error that it does not find the libraries, this tells me that it is possible to generate monorepo using that parameter in next-config. With this parameter you can specify a ROOT of the libraries to be used as a monorepo. I'm not 100% aware but I'm sure it will work if you look for more information on this. I can't take care of doing tests due to lack of time, but maybe at some point in the future I will dedicate myself to trying to solve it. |
@sonnydg, thank you for looking into this. When you have time, please create a PR so I can review and test out. |
@bestickley ooh! makes sense, it's good that you were able to find the problem. Thank you! |
@bestickley hello! Sorry for the delay in response. I'm going to try to test it in a new environment since I migrated everything to Linux :D, give me some time and I'll do the test. |
@sonnydg, have you been able to test within windows on new PR? |
Sorry, I haven't been able to do the tests yet because I've migrated everything to Linux, I don't have Windows :( Maybe someone else can do the test. |
closing in favor of #183 |
Hello! I am having the following issue when accessing the Cloudfront URL:
I see this error through CloudWatch in the nextjsServerFn lambda
Cannot find package 'next' imported from /var/task/index.mjs"
cdk-nextjs v4.0.0-beta.10 - next@13
The text was updated successfully, but these errors were encountered: