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
[@aws-cdk/aws-lambda-nodejs] Failed to bundle asset TestStack/handler/Code/Stage: test/lib/lib/test-stack.handler.ts does not exist #10174
Comments
Can you try with a path relative to path.join(__dirname, '..'); // adapt '..' if needed Adapt |
@jogold yep, that seems to work. It would be good if it worked out of the box with sensible defaults for the usual use cases :) |
Agree |
Fallback to lock files and then finally to `package.json` if no git repository can be found. Closes aws#10174
Fallback to lock files and then finally to `package.json` if no git repository can be found. Closes #10174 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I was consistently hitting this issue in AWS CodeBuild as well, I haven't run into this problem in my dev environment though. To troubleshoot this issue, I have put in some console.logs into util.js and run it on CodeBuild to see what's different. When running in CodeBuild, it seems the But when it's the turn to find the It turned out the As a result, I have implemented a new method in util.ts called Here is the PR: #10331 I do have to add a new nodejs library and in order to pass the pgklint test, that package was added to the root package.json's After I made the change and built the js files, I have tested with my own CodeBuild job by swapping out util.js and bundling.js during build time and the error no longer persists. |
Changed projectRoot to start search from the directory where new LambdaNodeJsFunction() is located Related to aws#10174
Changed projectRoot to start search from the directory where new LambdaNodeJsFunction() is located Refs aws#10174
Specifying
projectRoot
for theNodejsFunction
seems to fail the local parcel bundling. If we don't specifyprojectRoot
the project will fail in AWS CodePipeline with an errorError: Cannot find project root. Please specify it with projectRoot
.Could you please provide a reference setup of how the construct is meant to be used?
Reproduction Steps
Initialize an empty project and run
npm install --save-dev parcel@next
.What did you expect to happen?
I would expect the code to be synthesized properly.
What actually happened?
Synthetizing the code will lead to an error:
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: