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

Removing serverless dashboard breaks lambda imports #11686

Open
4 tasks done
Dollab opened this issue Jan 16, 2023 · 4 comments
Open
4 tasks done

Removing serverless dashboard breaks lambda imports #11686

Dollab opened this issue Jan 16, 2023 · 4 comments
Assignees
Labels

Comments

@Dollab
Copy link

Dollab commented Jan 16, 2023

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest v3 release?

  • Yes, I'm using the latest v3 release

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

We're using serverless in conjunction with serverless-webpack to transpile and bundle our lambda code (written in typescript). Everything is working fine with the serverless dashboard enabled, but breaks down if we remove it (by suppressing the org and app fields of the serverless.yml configuration file).

The error we get when invoking the lambda after disabling the dashboard references an import issue but we couldn't find out why, the packaged code seems perfectly identical as the one with the dashboard enabled :

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'model'\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/Runtime.js\n- /var/runtime/index.js",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'model'",
        "Require stack:",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/Runtime.js",
        "- /var/runtime/index.js",
        "    at _loadUserApp (/var/runtime/UserFunction.js:225:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:300:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:34)",
        "    at Module._compile (internal/modules/cjs/loader.js:1085:14)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
        "    at Module.load (internal/modules/cjs/loader.js:950:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}

our tsconfig file :

{
  "compilerOptions": {
    "module": "CommonJS",
    "target": "ES2017",
    "noImplicitAny": true,
    "preserveConstEnums": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "strictNullChecks": true,
    "inlineSources": true,
    "inlineSourceMap": true,
    "sourceRoot": "src",
    "outDir": ".build",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "lib": [
      "es2017",
      "dom"
    ],
    "rootDir": "./src",
    "resolveJsonModule": true
  },
  "include": ["src/**/*"],
}

We're targeting node14 runtimes on aws.

Service configuration (serverless.yml) content

N/A

Command name and used flags

serverless deploy

Command output

N/A

Environment information

Framework Core: 3.26.0 (local) 3.12.0 (global)
Plugin: 6.2.2
SDK: 4.3.2
@medikoo
Copy link
Contributor

medikoo commented Jan 18, 2023

@Dollab It looks as two issues:

  1. Some issue on AWS side where it's runtime module crashes most likely on attempt of resolving the handler. I would report it to AWS, as even if there's an issue with handler you should not see this kind of crash (note that in stack trace there are only AWS runtime modules involved)
  2. Issue with your configuration or webpack plugin. Dashboard plugin when on, was most likely fixing this issue by reconfiguring the handler. Now when it's off, it's purely webpack plugin that messes with handler configuration. If it crashes you should either resort to your config or report at webpack plugin repository

@Dollab
Copy link
Author

Dollab commented Jan 18, 2023

Thanks a lot @medikoo It definitely seems like the problem is 2. Where can I find the code used by serverless to reconfigure handler when the dashboard is on. This might help me understand what's wrong with the webpack configuration.

@Dollab
Copy link
Author

Dollab commented Feb 28, 2023

Thanks a lot !

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

No branches or pull requests

2 participants