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

Debug Node AWS Lambda Function with serverless offline causes Error #581

Closed
ManuelMos opened this issue Jan 28, 2019 · 4 comments
Closed

Comments

@ManuelMos
Copy link

This is a Bug Report

Description

  • My Environment: Windows 10, node.js 10.15.0, sls 1.36.1.

I try to debug my nodejs lambda function with serverless offline.

Running
node --inspect node_modules/.bin/serverless offline

causes:

basedir=(dirname "(echo “$0” | sed -e ‘s,,/,g’)")
^^^^^^^
SyntaxError: missing ) after argument list
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)

Same when i try to run it in intellij:
image

@dherault
Copy link
Owner

Hi @ManuelMos,
It seems that the issue concerns vm.js, i.e. Nodejs's core.
can you check that node --inspect node_modules/.bin/serverless offline is actually node --inspect node_modules/.bin/serverless-offline ?

@ocramot
Copy link

ocramot commented May 2, 2019

Hello, I'm having the same issue.

I'm on Ubuntu 18.04.1 LTS, with Node v8.15.1, serverless v1.40.0 and serverless-offline 3.33.0

I have checked and there is not a hypen, there is a space. Putting a hypen gives a completely different error:
Error: Cannot find module '/my/project/path/node_modules/.bin/serverless-offline' at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Function.Module.runMain (module.js:694:10) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3

@dnalborczyk
Copy link
Collaborator

@ManuelMos @ocramot If you are still having this issue, could you try:

node --inspect ./node_modules/.bin/serverless offline (notice the dot slash)

may be related to (although this mentions only node v11.x): nodejs/node#25967

feel free to re-open if you think this is an issue with serverless-offline.

@pecata83
Copy link

pecata83 commented Nov 23, 2019

Hello i had same issue on my Windows 10, managed to solve it by changing the path as shown bellow.

"debug": "SET SLS_DEBUG=* && node --inspect %USERPROFILE%\\AppData\\Roaming\\npm\\node_modules\\serverless\\bin\\serverless offline -s dev",

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

5 participants