You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hello-world typescript project generated by SAM init could work, but when I import a npm package jsonpath and run it locally, it raises a Runtime.ImportModuleError.
Steps to reproduce:
sam init, AWS Quick Start Templates, Hello World Example, nodejs18.xZip, Hello World Example TypeScript
cd hello-world , npm install jsonpath, npm i --save-dev @types/jsonpath
I did some investigations on this issue.
Hello-world for javascript could work, the HelloWorldFunction folder makes sense
But the HelloWorldFunction folder of Typescript looks a bit wired.
There is no node_modules under HelloWorldFunction folder. Refer to this log Mounting /path-to/sam-app3/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated, inside runtime container from sam local start-api. I think sam didn't bundle the dependences. But I do see this from sam local 🤔
Hi @jfuss Thanks for your reply, I have installed the jsonpath successfully. I think that's a issue from json-path package. I use another package with SAM, it works well.
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
595972434
changed the title
Bug: SAM Template for Typescript can't import npm package
Bug: SAM Template for Typescript can't import json-path package
Apr 17, 2023
Description:
The hello-world typescript project generated by SAM init could work, but when I import a npm package jsonpath and run it locally, it raises a
Runtime.ImportModuleError
.Steps to reproduce:
sam init
,AWS Quick Start Templates
,Hello World Example
,nodejs18.x
Zip
,Hello World Example TypeScript
cd hello-world
,npm install jsonpath
,npm i --save-dev @types/jsonpath
sam build
sam local start-api
curl http://127.0.0.1:3000/hello
This is my code in
app.ts
Observed result:
{"message":"Internal server error"}
and got an error from samExpected result:
Get
["London", "Berlin", "Madrid", "Rome"]
from curl commandAdditional environment details (Ex: Windows, Mac, Amazon Linux etc)
I did some investigations on this issue.

Hello-world for javascript could work, the
HelloWorldFunction
folder makes senseBut the

HelloWorldFunction
folder of Typescript looks a bit wired.There is no node_modules under
HelloWorldFunction
folder. Refer to this logMounting /path-to/sam-app3/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated, inside runtime container
fromsam local start-api
. I think sam didn't bundle the dependences. But I do see this fromsam local
🤔The text was updated successfully, but these errors were encountered: