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
Exclude not excluding a node_modules subdirectory #7837
Comments
Note that the reason that aws-sdk isn't getting automatically excluded by the |
@nampas thanks for report. There are known issues with packaging in general, and there's a dedicated issue for that: ehttps://github.com//issues/6580 Still any PR that fixes that before broader refactor is made is welcome |
Sounds good, thanks for the response. |
@nampas You can use include insted of exclude to achive what you want:
Hint: If you want you code works with node_modules from lambda you need to put it into nodejs directory. https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path Our project lambda package build looks like this:
Additionaly the nodejs directory can be build with the --production flag. |
I think this issue is related to #8612 (fact that package patters are resolved against layer directory path and not a service path). |
same issue |
I was trying to pull all my node_modules into a lambda layer, but running into an issue because the lambda layer is too big.
Fair enough, it is big. I went ahead and tried to exclude the aws-sdk node_modules subdirectory:
That doesn't work though. I'm still getting the aws-sdk included in the zip:
serverless.yml
REPLACE WITH FULL COMMAND NAME
output$ SLS_DEBUG=* sls package
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command s3remove
Serverless: Load command invoke
Serverless: Load command invoke:stepf
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Load command dev
Serverless: [AWS ssm 400 0.207s 0 retries] getParameter({ Name: 'resourceSync-graphApiSecret-dev',
WithDecryption: false })
Serverless: [AWS ssm 400 0.222s 0 retries] getParameter({ Name: 'resourceSync-datadogApiKey-dev',
WithDecryption: false })
Serverless: [AWS ssm 400 0.207s 0 retries] getParameter({ Name: 'resourceSync-rollbarToken-dev', WithDecryption: false })
Serverless Warning --------------------------------------
A valid SSM parameter to satisfy the declaration 'ssm:resourceSync-rollbarToken-dev' could not be found.
Serverless Warning --------------------------------------
A valid SSM parameter to satisfy the declaration 'ssm:resourceSync-rollbarToken-dev' could not be found.
Serverless Warning --------------------------------------
A valid SSM parameter to satisfy the declaration 'ssm:resourceSync-rollbarToken-dev' could not be found.
Serverless: [AWS ssm 400 0.164s 0 retries] getParameter({ Name: 'resourceSync-sumoEndpoint-dev', WithDecryption: false })
Serverless Warning --------------------------------------
A valid SSM parameter to satisfy the declaration 'ssm:resourceSync-sumoEndpoint-dev' could not be found.
Serverless Warning --------------------------------------
A valid SSM parameter to satisfy the declaration 'ssm:resourceSync-sumoEndpoint-dev' could not be found.
Serverless Warning --------------------------------------
A valid SSM parameter to satisfy the declaration 'ssm:resourceSync-sumoEndpoint-dev' could not be found.
Serverless: [AWS ssm 400 0.186s 0 retries] getParameter({ Name: 'resourceSync-tokenAuthorizerKey-dev',
WithDecryption: false })
Serverless: [AWS cloudformation 200 0.51s 0 retries] describeStacks({ StackName: 'resourceSync-outputs-dev' })
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: [AWS cloudformation 400 0.218s 0 retries] describeStacks({ StackName: 'resourceSync-dev' })
Serverless: Invoke aws:package:finalize
Serverless: Invoke aws:common:moveArtifactsToPackage
Installed version
The text was updated successfully, but these errors were encountered: