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

TypeError: Cannot read properties of undefined (reading 'split') #280

Open
mdrijwan opened this issue Sep 12, 2022 · 5 comments · May be fixed by #291
Open

TypeError: Cannot read properties of undefined (reading 'split') #280

mdrijwan opened this issue Sep 12, 2022 · 5 comments · May be fixed by #291

Comments

@mdrijwan
Copy link

i'm trying to deploy docker image through sls

functions:
  generatePdf:
    # handler: src/api/generate.pdf
    images: 498157479666.dkr.ecr.ap-southeast-1.amazonaws.com/automate-pdf:latest@sha256:98e17f123e538564dff238122cc31ab38ddf1e735e4cc5f7be853cc2cc5e1dee
    description: A lambda handler that generates PDF file from payload data and upload it to S3 bucket.
    memorySize: 2048
    provisionedConcurrency: 2
    events:
      - http:
          path: pdf
          method: POST
          cors: true
          documentation:
            summary: Generates PDF from payload
            tags:
              - generatePdfS3

it works perfectly with handler but the moment i switch to images, it throws this weird error

TypeError: Cannot read properties of undefined (reading 'split')
    at /Users/rijwan/code/second/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/typescript.js:57:33
    at Array.map (<anonymous>)

Screenshot 2022-09-13 at 12 01 31 AM

my sls version is as below:

Framework Core: 3.22.0
Plugin: 6.2.2
SDK: 4.3.2
@mdrijwan
Copy link
Author

any update?

@mdrijwan
Copy link
Author

still getting error

❯ sls deploy --verbose
Running "serverless" from node_modules

Deploying pdf-api to stage dev (ap-southeast-1)

Packaging
Compiling with Typescript...
Using local tsconfig.json - tsconfig.json

✖ Stack pdf-api-dev failed to deploy (0s)
Environment: darwin, node 12.16.3, framework 3.22.0 (local) 3.22.0v (global), plugin 6.2.2, SDK 4.3.2
Credentials: Local, "default" profile
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
TypeError: Cannot read property 'split' of undefined
    at /Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/typescript.js:57:33
    at Array.map (<anonymous>)
    at Object.extractFileNames (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/typescript.js:56:10)
    at TypeScriptPlugin.get rootFileNames [as rootFileNames] (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:102:27)
    at TypeScriptPlugin.<anonymous> (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:159:59)
    at Generator.next (<anonymous>)
    at /Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:4:12)
    at TypeScriptPlugin.compileTs (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:143:16)
    at TypeScriptPlugin.<anonymous> (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:58:28)
    at Generator.next (<anonymous>)
    at /Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:4:12)
    at before:package:createDeploymentArtifacts (/Users/rijwan/code/automate-pdf-api/node_modules/serverless-plugin-typescript/dist/src/index.js:57:63)
    at PluginManager.runHooks (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/classes/plugin-manager.js:530:15)
    at PluginManager.invoke (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/classes/plugin-manager.js:563:20)
    at async PluginManager.spawn (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/classes/plugin-manager.js:585:5)
    at async before:deploy:deploy (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/plugins/deploy.js:40:11)
    at async PluginManager.runHooks (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/classes/plugin-manager.js:530:9)
    at async PluginManager.invoke (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/classes/plugin-manager.js:563:9)
    at async PluginManager.run (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/classes/plugin-manager.js:604:7)
    at async Serverless.run (/Users/rijwan/code/automate-pdf-api/node_modules/serverless/lib/serverless.js:174:5)
    at async /Users/rijwan/code/automate-pdf-api/node_modules/serverless/scripts/serverless.js:771:9

2 deprecations found: run 'serverless doctor' for more details

@vekaev
Copy link

vekaev commented Oct 6, 2022

Seems to me node 17 doesn't supported by aws

@kristofegedy
Copy link

I've run into the same issue, lambda fails when you try to use any import..
( Node 17 is not in the picture at all. I've tried it with 12 and 14. ) Tried both the 2.1.4 and the 2.1.2 version of the plugin...

Switched to serverless-esbuild and the issue went away.

@nathanbbarton
Copy link

@mdrijwan Running into this myself now, did you ever have any luck resolving this?

@lb-ronyeh lb-ronyeh linked a pull request Jun 8, 2023 that will close this issue
2 tasks
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

Successfully merging a pull request may close this issue.

4 participants