-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
NodeJs custom module can't be required on Mac OS but working on windows #1481
Comments
I have the same issue but with an installed module "aws-serverless-express". When invoking a simple Lambda locally none of my imports work.
when I invoke the function locally I get the following error
if I change the order of the awsServerlessExpress and app imports then none of the imports in the app.js file work either. here is the CDK code I used to define the lambda...
|
@jfuss can you please help look into this, I have no idea how to setup my local env in Mac now. |
@XiamiYoung We do not support local file references currently. You can find more details in my response here. The current requirement is all code for the function needs to be within the CodeUri/Code property folder. When we invoke, we only mount that folder of the function. If there is code outside that folder that is needed, it is not mounted and therefore not accessible/importable/etc. You can adjust the CodeUri/Code Property to include that folder as well, copy the code into the CodeUri/Code directory, or produce a fully contained function (build) and point the CodeUri/Code to that. We have issues for supporting |
Hi @jfuss Thank you |
@jfuss are there some examples of how to make this happen while keeping the code out of the main CodeUri directory? |
Description
I have a custom module need be shared by multiple lambdas from layer, when I add this custom module into dependencies and call sam local invoke, on windows it's working, on Mac OS it's failing. I've tried on Windows deploy this to AWS it's working so assuming it's a sam problem.
Steps to reproduce
Test same code on windows, it's working, I can see console log printed.
Open Mac finder and check dependencies/nodejs/node_modules, found my-module is an Alias folder, if I delete this Alias folder and hard copy my-module folder here.
call sam local invoke --no-event, and check result again, it's working!
Observed result
On Mac OS, custom module can't be required properly.
Expected result
custom module should be required successfully.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:SAM CLI, version 0.23.0Add --debug flag to command you are running
The text was updated successfully, but these errors were encountered: