ImportModuleError
See original GitHub issueI have a rather simple serverless config, with no other plugins, no package exclude patters, yet I get a ModuleImportError upon deployment. The only potential deviation from the most basic example in the README is that I’ve configured Serverless to build and deploy an image rather than a zip. Any ideas?
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 's_warmUpPluginWarmer'\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module 's_warmUpPluginWarmer'",
"Require stack:",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:202:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
" at internal/main/run_main_module.js:17:47"
]
}
My Serverless config:
provider:
name: aws
region: eu-west-1
memorySize: 1024
timeout: 900 #sec
deploymentBucket:
name: ${opt:stage}-smp-serverless-deployment
iam:
role: ${ssm:/${opt:stage}-lambda-serverless-role-arn}
ecr:
images:
appimage:
path: ./
plugins:
- serverless-plugin-warmup
functions:
main:
name: ${opt:stage}-conv
environment:
INPUT_S3_BUCKET: ${ssm:/${opt:stage}-file-upload-bucket-name}
image:
name: appimage
custom:
warmup:
warmer:
enabled: true
package:
events:
- schedule: rate(10 minutes)
concurrency: 10`
Many thanks in advance!
Issue Analytics
- State:
- Created 2 years ago
- Comments:29 (11 by maintainers)
Top Results From Across the Web
"Runtime.ImportModuleError" trying to access npm ...
ImportModuleError : Error: Cannot find module 'request'", "Require stack:", ... ...as if the layer had never been added. The error is exactly the ......
Read more >Resolve the "Unable to import module" error for Lambda code ...
I receive the "Unable to import module" error when I try to run my AWS Lambda code in Node.js. Short description. You typically...
Read more >Lambda fails: "Runtime.ImportModuleError: Error: Cannot find ...
After successfully deploying my stack using serverless deploy , my lambda functions fail, citing a module import error Runtime.ImportModuleError ...
Read more >Prisma cloud[ERROR] Runtime.ImportModuleError: Unable to ...
We are getting the following error in our Lambdas, [ERROR] Runtime.ImportModuleError: Unable to import module 'twistlock': Failed to import - 404799.
Read more >How to Solve a AWS Lambda error - Runtime.ImportModuleError
ImportModuleError : Error: Cannot find module 'jmespath'. AWS Lambda scripts written in nodejs8 were deprecated. You run the same scripts via AWS ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@juanjoDiaz Thanks for the prompt response. My mistake on the version number, that was a mistype on my end! 7.1.0 is the one I am on.
So I actually just got everything working on my end using what minu2020 had pasted above (adding in the package options to my config) on Feb 1, 2022. I’m still not entirely sure what the issue was, but everything seems to be alright now.
The warmup config that I am now using successfully is:
Well, I was very sceptical it would work with docker package but hooray, it did!: