Describe the bug
I made a mistake today and published a lambda referencing a local package:
"dependencies": {
"aws-sdk": "^2.413.0",
"axios": "^0.18.0",
"my-local-package": "file:~/src/my-local-package",
}
Of course, the lambda doesn't execute properly (very much expected, and very much my fault). However, my local amplify-cli has now become completely unusable. Almost every command (even amplify status
) results in the following error:
error: uncaughtException: ENOENT: no such file or directory, stat '/Users/zach/src/project-name/amplify/.temp/#current-cloud-backend/function/function-name/src/node_modules/my-local-package'
The following did not solve this problem:
Furthermore, anyone who checks out my env
will also have their local amplify-cli end up in a permanently broken state.
To Reproduce
Steps to reproduce the behavior:
Follow the steps outlined in the description.
Expected behavior
I think there's two pieces of unexpected behaviour here:
Desktop (please complete the following information):
Okay, so I've found a terrible, awful solution to this problem:
#current-cloud-backend.zip
from the deployment (not the hosting) bucketfunction/function-name/src/node_modules
and replace the my-local-package
shortcut with an empty folder#current-cloud-backend.zip
@zjullion thank you for reporting this. I have updated the code not to include any content from functions node_modules when backing up the current_cloud_backend. This will help for new pushes, but won't be able to fix it for already pushed backend.
What is the recommended way to use locally created npm packages? npm link doesn't work because the zip file for the lambda doesn't follow the symlinks created by npm link.
Most helpful comment
What is the recommended way to use locally created npm packages? npm link doesn't work because the zip file for the lambda doesn't follow the symlinks created by npm link.