Skip to content
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

error with optimized lambda #13

Open
stevecrozz opened this issue Feb 2, 2016 · 4 comments
Open

error with optimized lambda #13

stevecrozz opened this issue Feb 2, 2016 · 4 comments

Comments

@stevecrozz
Copy link

I get this error on a lambda function when it has been optimized by this plugin. Without the plugin, the function works. I'm using the 'test' button from within the AWS console to produce this error:

{
  "errorMessage": "Cannot find module './aes'",
  "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)",
    "i (/var/task/ivr/selection/handler.js:1:497)",
    "/var/task/ivr/selection/handler.js:1:688",
    "/var/task/ivr/selection/handler.js:12:25267",
    "Array.map (native)",
    "Object.a.exports (/var/task/ivr/selection/handler.js:12:25244)",
    "o (/var/task/ivr/selection/handler.js:12:25428)"
  ]
}

I'm not sure how to debug this. But I can gather more info if you ask for something in particular.

@jordanmack
Copy link
Contributor

I'm also getting an error when trying to use optimizer with my project.

{
  "errorMessage": "Cannot find module '\/usr\/lib\/node_modules\/aws-sdk\/apis\/metadata.json'",
  "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)",
    "i (\/var\/task\/accounts\/register\/handler.js:1:497)",
    "\/var\/task\/accounts\/register\/handler.js:1:688",
    "n (\/var\/task\/accounts\/register\/handler.js:3:27116)",
    "Object.i [as services] (\/var\/task\/accounts\/register\/handler.js:3:27572)",
    "Object.<anonymous> (\/var\/task\/accounts\/register\/handler.js:6:1621)",
    "Object..\/api_loader (\/var\/task\/accounts\/register\/handler.js:6:1806)"
  ]
}

The endpoints that fail with this message do not rely directly on the aws-sdk. Instead they use dynamodb-doc. Disabling optimizer fixes the problem.

@jordanmack
Copy link
Contributor

Excluding aws-sdk from the optimzer fixed my issue.

"custom":
{
    "optimize": 
    {
        "exclude": ["aws-sdk"]
    }
}

@pcorey
Copy link

pcorey commented Jun 3, 2016

I'm getting a similar error when trying to import the "mongodb" module:

{"errorMessage":"Cannot find module './binary_parser'","errorType":"Error","stackTrace":["Function.Module._load (module.js:276:25)","Module.require (module.js:353:17)","require (internal/module.js:12:17)","o (/var/task/_serverless_handler.js:1:497)","/var/task/_serverless_handler.js:1:688","/var/task/_serverless_handler.js:1:16480","Array.forEach (native)","Object.a.10../bson (/var/task/_serverless_handler.js:1:16454)","o (/var/task/_serverless_handler.js:1:637)"]}

Unfortunately, excluding that module isn't an option for me. It's a needed dependency.

@Lepozepo
Copy link

Lepozepo commented Feb 1, 2017

I'm having the same issue but when I exclude it and deploy there's no issue running import on the lambda O_o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants