GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account. After successfully deploying my stack using serverless deploymy lambda functions fail, citing a module import error Runtime.

Because I need binaries built specifically for linux, the packaging and deployment takes place inside a docker container, the docker file is as follows:.

If I download the. If you require s-fetchUserData. Therefore in this case I believe require path should be '. This is handled automatically by serverless, so why the sudden failure? I haven't changed any mechanisms by which modules are imported. I don't think it could be Serverless. Correct me if I'm wrong, but serverless is responsible for generating the s-fetchUserData.

Sky factory 4 apple seeds

In no way am I responsible for importing this module in my code, so the error has to lie in the serverless packaging process? Otherwise is it a lambda-specific issue? I just don't see how it works for one deployment, then with no changes to the file structure, a subsequent deployment fails.

I had the same problem. The require-path to the actual function code is wrong in the serverless-generated instrumentation wrapper code. If you run serverless package you can verify that everything is correct.

Not exactly the same.

Dream of climbing over a fence

But the Error: Cannot find module '. But the function worked before adding serverless monitoring. Framework Core: 1. While Cannot find module 's-fetchUserData' is an error that indicates a problem with our internals s-fetchUserData is specific to enterprise-plugin which is unconditionally loaded by the Framework. Error on your side looks as error in your setup module path doesn't refer to anything Framework specific.

Same error for me, but my issue was that I was prefixing the path to the handler function in serverless. Incredibly annoying since it worked not too long ago with it, but happy the change was simple. Your response helped me track down the cause. Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Greg Shackles

Sign up. New issue. Jump to bottom.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I have tried both solutions provided in creating-a-lambda-function-in-aws-from-zip-file and simple-node-js-example-in-aws-lambda.

My config currently looks like:. What else could be causing this issue aside from what was stated in those two answers above? I have tried both solutions and I have also allocated more memory to the function just incase thats why it couldn't run. EDIT - For the sake of trying, I created an even simpler version of my original code and it looked like this:.

Critical analysis of a short story example

Try zipping and uploading the contents of the folder lambda-create-timelapse. Not the folder itself. Step 1 Navigate to the folder of your project, and open that folder so that you are inside the folder:. Step 2 Select all of the images you want to upload into to Lambda:. Step 3 Right-click and compress the files you have selected:. I ran into this problem a few times myself, and this indeed has to do with zipping the folder instead of just the contents like you're supposed to.

The problem occurs when the handler cannot be located in the zip at first level. So anytime you see such error make sure that the file is at the first level in the exploded folder.

This is a (Bug Report)

You may have other syntax errors that prevent the index. Try running your code locally using another file and using the index. Learn more.

Asked 4 years, 8 months ago. Active 4 months ago. Viewed 28k times. Andrew Font Andrew Font 1, 2 2 gold badges 16 16 silver badges 31 31 bronze badges.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here.

Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I'm tired of this error! Locally it works perfectly. Testing locally didn't work for load of other reasons. I'm testing in staging. Yet I'm getting this error:. I followed all the steps advised elsewhere including: moving all dependencies to dependencies out of devinstalling serverless and all. I'm using Node 6. Can you help?

Diagzone pro vs x431 pro

If you're trying host your nodejs projects which has so many dependencies not related to aws services inside, you better zip your projects in S3 first then import lambda from S3. Learn more. Asked 1 year, 4 months ago.

Active 1 year, 4 months ago. Viewed times. Lee Moe Lee Moe 2 2 silver badges 15 15 bronze badges. Active Oldest Votes. But the dependency it's asking for is written by me. Does this still apply? Jeez how dumb of me! Will try what you said. LeeMoe pls don't forgot to mark my answer as correct after you fixed it.

I did it again because this is how it was done first place and I'm getting the same error. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. The Overflow How many jobs can be done at home?

Featured on Meta.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account. When deploying multiple versions of a service or just versions of the function within the service, but sometimes some modules are not included in the package in presence of a package. Hey xmissio thanks for opening! This could be related to I see.

You're running v1. This feature was introduced in v1. So updating Serverless should do the trick here. However we're currently working on a long-term fix for this which should be shipped soon. I deleted. I downgraded to 1. Just took another look at it. I am experiencing this issue in 1. I have not tried excludeDevDependencies: false. Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Dejt karlskoga

Sign up. New issue. Jump to bottom.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account. However, without using the layers configuration the functions run successfully. For this reason I figured it may be a bug. Then I tried to package my node modules in a nodejs folder as per these instructions and used the package artifact key instead of the more explicit way of adding layers that I included above:.

Many others and I also facing the same issue.

serverless cannot find module

Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. New issue. Jump to bottom. Lambda fails: "Runtime. Copy link Quote reply. This is a Bug Report Description What went wrong? I created two lambda layers and when I tested the lambda's on which they depend I got the following error: Runtime.

ImportModuleError: Error: Cannot find module However, without using the layers configuration the functions run successfully.

serverless cannot find module

What did you expect should have happened? The lambdas to run successfully What was the config you used? Serverless Framework Version you're using : Framework Core: 1. This comment has been minimized. Sign in to view. Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment. Linked pull requests. You signed in with another tab or window. Reload to refresh your session.GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. Already on GitHub? Sign in to your account. Exact commands I executed:. Noting that this resulted in serverless pulling in spawn-sync 2. Maybe serverless just needs to drop it out? The commands from JohnathanKong worked for me on Ubuntu I also had to run them as sudo. I had the same issue and realised that I had not have serverless within my package.

Skip to content. Dismiss Join GitHub today GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. New issue. Jump to bottom. Copy link Quote reply. Exit status 1 npm ERR! Failed at the spawn-sync 1. This is probably not a problem with npm.

There is likely additional logging output above. A complete log of this run can be found in: npm ERR! Install serverless with out error. What was the config you used? Operating System : Ubuntu RafalWilinski added bug help wanted labels Sep 28, This comment has been minimized.

Sign in to view.

serverless cannot find module

RafalWilinski added the more-info-needed label Sep 28, I've managed to reproduce the issue on Ubuntu Here's more detailed log: 78 verbose linkBins serverless 1. Same issue here on Ubuntu Exact commands I executed: npm install -g try-thread-sleep npm install -g serverless --ignore-scripts spawn-sync and now serverless is working. It installed 1. Experiencing this issue here as well. Using macOS.

Same on macOS. Same issue raise for me. Same error on Docker image nodealpine.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

But if I upload the. I was having a similar error to you while using the explicit layers keys that you are using to define a lambda layer.

Simple mobile application example

I created a bug report in Serverless for this issue. If anyone else is having this same issue they can track it there. I followed this this post in the Serverless forums based on these docs from AWS. Then instead of using the explicit definition of layers I used the package and artifact keys like so:.

You can download the. Learn more. Asked 1 year ago. Active 2 months ago. Viewed 3k times. When I deploy my serverless api using: serverless deploy The lambda layer gets created but when I go to run the function is gives me this error: "Cannot find module 'request'" But if I upload the.

Any one have any idea why this is happening?

Subscribe to RSS

Mikerizzo Mikerizzo 4 4 silver badges 19 19 bronze badges. Active Oldest Votes. My error for the sake of web searches was this: Runtime. Then instead of using the explicit definition of layers I used the package and artifact keys like so: layers: test: package: artifact: test. Not worked for me. Still error: Error: Cannot find module '.

Elon Zito Elon Zito 2, 16 16 silver badges 20 20 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. The Overflow How many jobs can be done at home?

Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow. Triage needs to be fixed urgently, and users need to be notified upon….