Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I keep getting this error in the aws-lambda console when uploading code from a zip file. I have tried uploading other zip files and they work correctly. The .js file is named "CreateThumbnail.js" in the zip file. I believe the handler is also named properly "CreateThumbnail.handler". the node_modules subdirectory is also setup. Anyone have any idea?

{
  "errorMessage": "Cannot find module 'CreateThumbnail'",
  "errorType": "Error",
  "stackTrace": [
  "Function.Module._resolveFilename (module.js:338:15)",
  "Function.Module._load (module.js:280:25)",
  "Module.require (module.js:364:17)",
  "require (module.js:380:17)"
  ]
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
175 views
Welcome To Ask or Share your Answers For Others

1 Answer

The way I was able to get this to work was:

  1. Name the file exports.js
  2. Name the handler, within the file, exports.handler
  3. Set the handler in the lambda config to exports.handler
  4. Zip up only the contents of the folder, not the folder itself (as mentioned above) and rename the zip file exports.zip

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...