Closed 595972434 closed 1 year ago
@595972434 npm install jsonpath
doesn't update package.json
right? You need to provide --save-prod
for that?
Is jsonpath
in the package.json
?
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.
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
🤔