I'm following the hello world api guide, but came ...
# help
e
I'm following the hello world api guide, but came across an error when `npx sst start`:
Copy code
> npx sst start
Using stage: eric
Preparing your SST app

=======================
 Deploying debug stack
=======================


Deploying stacks

 ✅  eric-notes-debug-stack (no changes)


Stack eric-notes-debug-stack
  Status: no changes
  Outputs:
    BucketArn: arn:aws:s3:::eric-notes-debug-stack-bucket83908e77-1t8nnnx6tioir
    BucketName: eric-notes-debug-stack-bucket83908e77-1t8nnnx6tioir
    Endpoint: <wss://c4a03wehy6.execute-api.us-east-2.amazonaws.com/eric>


===============
 Deploying app
===============


TypeError: app.setDefaultFunctionProps is not a function
    at Module.default (file:///home/eric/code/serixscorpio/notes/.build/lib/index.js:23:7)
    at file:///home/eric/code/serixscorpio/notes/.build/run.mjs:92:16


There was an error synthesizing your app.
I think the only thing I modified from the hello world was changing
import { App } from "@..."
to
import App from "@.."
to address the commonjs module error
r
Are you talking about this file? So in your app you changed the
{ App }
to just
App
? Could you paste a screenshot of your stack index?
e
I think I did for both
index.js
and
MyStack.js
r
hmm ok I am not sure I am following why those were changed from
import { Api } from "@serverless-stack/resources";
and
import { App } from "@serverless-stack/resources";
but if you do
import Api from "@serverless-stack/resources";
Api will end up being all the exports from this file https://github.com/serverless-stack/serverless-stack/blob/master/packages/resources/src/index.ts What was the commonjs module error you were trying to get around in the first place?
e
Thanks in advance for helping! Let me revert and get the commonjs error back.
r
odd, ok can you run
npm list
from your
/home/eric/code/serixscorpio/notes
folder. Just curious what versions of things you have installed for this.
oh interesting your
resources
package is really old. it should be like
1.2.23
i think its always in sync with the cli. if you run
npx sst update
does it get that back in order?
e
resources
now updated to
1.2.23
! let me see if I can get past the commonjs error
r
there we go. does that run now?
e
I think so! Hmm.. not sure if I would be able to reproduce the issue I faced. I recall following the instructions at https://serverless-stack.com/chapters/create-an-sst-app.html and then at https://serverless-stack.com/chapters/create-a-hello-world-api.html.
r
So essentially
Copy code
$ npm init sst javascript-starter notes
$ cd notes
$ npm install
$ npx sst start
Just threw that together here and all seems good. It put together this
package.json
Not sure how ya got it in that state, but sounds like its working ok now
e
FWIW, Another thing I recalled is at one point I did
npm audit fix --force
, which is probably what downgraded to
@serverless-stack/cli@0.4.5
my bad, probably should have just left the audit warnings.
Thank you for your help. This unblocked me. I'm looking forward to live lambda debugging!
r
oh dang ok thats good to know. so @thdxr looks like you get this warning just following the basic 4 steps in the intro guide . So folks then run the
audit fix --force
which puts resources out of sync with the cli. looks like you end up with 0.4.5
e
This new issue seems relevant https://github.com/serverless-stack/serverless-stack/issues/1804 , but an older issue https://github.com/serverless-stack/serverless-stack/issues/690 seems to suggest the work is more involved. Anyway, really appreciate the fine work here!
r
Yeah I know fighting these vulnerability warnings is rough. Likely that code never makes it into the end product anyway. But probably good to know that if you follow the guide steps and what you see on screen you end up with something broken.
f
@Ross Gerbasi thanks for looking into this!
arr.. yeah quite a few folks have been bitten by the warning. Bumping up the priority on the GitHub issue.