auth0 / repo-supervisor

Scan your code for security misconfiguration, search for passwords and secrets. :mag:
MIT License
637 stars 88 forks source link

AWS Lambda deployment && "SyntaxError: Unexpected token '<'" #78

Open setevoy2 opened 3 years ago

setevoy2 commented 3 years ago

Description

The deployment guide about AWS Lambda is incomplete and it's hard to realize how to run the code. After eventually ran it, got the error saying:

{ "errorType": "Runtime.UserCodeSyntaxError", "errorMessage": "SyntaxError: Unexpected token '<'", "stack": [ "Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token '<'", " at _loadUserApp (/var/runtime/UserFunction.js:98:13)", " at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)", " at Object. (/var/runtime/index.js:43:30)", " at Module._compile (internal/modules/cjs/loader.js:1072:14)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)", " at Module.load (internal/modules/cjs/loader.js:937:32)", " at Function.Module._load (internal/modules/cjs/loader.js:778:12)", " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)", " at internal/main/run_main_module.js:17:47" ] }

Provide a clear and concise description of the issue, including what you expected to happen.

Reproduction

As there is no defined Handler in the docs, I did the following:

  1. cloned the repository to my local machine from the Releases page (3.10, latest)
  2. ran the npm install to install packages (as previously got the "Runtime.ImportModuleError: Error: Cannot find module '@octokit/rest'" error)
  3. created a zip-archive with the node_modules included and uploaded it to an AWS Lambda function
  4. added an API Gateway

Now, when creating a PR in a Github repository, it fails with the 500 error and the function's CloudWatch logs days about the "SyntaxError" error.

Environment

Runtime: Node.js 14.x (the same issue when using 10.x which is mentioned in the docs) Handler: src.index.lambda