Howdy! I get an error when running `start` with th...
# help
p
Howdy! I get an error when running
start
with the latest version. It shows up when I update an existing lambda while running:
Copy code
Functions: Building . src/get.main...
Functions: Done building . src/get.main (30ms)

Oops! Something went wrong! :(

ESLint: 8.10.0

Error: Failed to load plugin '@typescript-eslint' declared in 'package.json » eslint-config-serverless-stack': Cannot find module 'typescript'
Require stack:
- /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/util/astUtils.js
- /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js
- /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
- /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
- /Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/index.js
- /Users/pal/temp/rest-api/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
Referenced from: /Users/pal/temp/rest-api/node_modules/eslint-config-serverless-stack/index.js
  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
  at Function.Module._load (internal/modules/cjs/loader.js:746:27)
  at Module.require (internal/modules/cjs/loader.js:974:19)
  at require (/Users/pal/temp/rest-api/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
  at Object.<anonymous> (/Users/pal/temp/rest-api/node_modules/@typescript-eslint/eslint-plugin/dist/util/astUtils.js:27:25)
  at Module._compile (/Users/pal/temp/rest-api/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
  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 Module.require (internal/modules/cjs/loader.js:974:19)
This was just reproduced by using
examples/rest-api
and upgrading to
0.67.0
.
d
just hit the same error, just following "Getting Started", also got
No stacks found for app my-sst-app and stage local
when hitting the console and this error when trying to hit my lambda with a GET:
Copy code
in browser: {"message":"Internal Server Error"}

in local terminal: {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Runtime.HandlerNotFound: /Users/doda/pr/sst-test/my-sst-app/.sst/artifacts/admin-my-sst-app-my-stack-Api-Lambda_GET_-/src/lambda.handler is undefined or not exported" ...
f
Lemme give it a try
d
ran via
npx create-serverless-stack@latest my-sst-app
on node v14.8.0 and npm v6.14.7
f
@Dominik Dabrowski hmm… from the browser error
Copy code
No stacks found for app my-sst-app and stage local
It seems it’s trying to connect to
local
stage. But in the terminal error message
Copy code
... admin-my-sst-app-my-stack-Api-Lambda_GET_-/src/lambda.handler is undefined or not exported" ...
It’s using the
admin
stage.
Can you show me the commands u ran after u did
npx create-serverless-stack@latest my-sst-app
?
d
Hmm, I think I just did
npm run start
and confirmed the default value there
admin
f
I see.. and can I see the URL you are going to in the browser?
d
it was the one from the console
<http://console.serverless-stack.com/my-sst-app/local|console.serverless-stack.com/my-sst-app/local>
re-deploying it rn
but still getting the error when invoking the lambda endpoint, and a
typescript
import error when modifying the lambda locally
traceback (2 invokations and 1 save file on lambda) https://gist.github.com/doda/5b567c2d3b744f3175c8e8fbad64c200
f
Thanks for the details. Let me look into the typescript error.
d
the getting started page in docs 😅
f
Ah gotcha. Those are dummy links. Just updated the doc to put in real links.
@thdxr have seen this
Cannot find module 'typescript'
error? https://gist.github.com/doda/5b567c2d3b744f3175c8e8fbad64c200
I’m not able to reproduce it on my end
t
does installing ts fix it?
f
@thdxr ah i managed to reproduce it
So even for a JS project,
eslint-config-serverless-stack
is looking for
typescript
.
Yeah tested that adding
typescript
as a devDependency fixes it. But it doesn’t make sense for JS projects to do that right?
t
the reason this was working before is because it was hijacking the typescript dep from sst/core which I moved to devdep
I'm realizing we need to track down all of these hijacking situations and make sure things aren't depending on that
I'll add back the typescript dep but we have a few things lingering like this that need cleanup
f
This is fixed in v0.67.1
p
Well done once again! Thanks @Frank & @thdxr!
I still actually get the following on save:
Copy code
Oops! Something went wrong! :(

ESLint: 8.10.0

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "/Users/pal/dev/xyz".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in "package.json » eslint-config-serverless-stack".

If you still can't figure out the problem, please stop by <https://eslint.org/chat/help> to chat with the team.
f
cc @thdxr
d
Not getting any problems on save anymore, but do get this on
GET
to the endpoint:
Copy code
==========================
 Starting Live Lambda Dev
==========================

SST Console: <https://console.serverless-stack.com/my-sst-app3/admin/local>
Debug session started. Listening for requests...
80afde6a-5547-43e9-934a-b2f4f307e798 REQUEST admin-my-sst-app3-my-stack-ApiLambdaGETB1714EF3-gesgHZsoJzY0 [src/lambda.handler] invoked by API GET /
Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Runtime.HandlerNotFound: /Users/doda/pr/sst-test/my-sst-app3/.sst/artifacts/admin-my-sst-app3-my-stack-Api-Lambda_GET_-/src/lambda.handler is undefined or not exported","reason":"Runtime.HandlerNotFound: /Users/doda/pr/sst-test/my-sst-app3/.sst/artifacts/admin-my-sst-app3-my-stack-Api-Lambda_GET_-/src/lambda.handler is undefined or not exported","promise":{},"stack":["Runtime.UnhandledPromiseRejection: Runtime.HandlerNotFound: /Users/doda/pr/sst-test/my-sst-app3/.sst/artifacts/admin-my-sst-app3-my-stack-Api-Lambda_GET_-/src/lambda.handler is undefined or not exported","    at process.<anonymous> (file:///Users/doda/pr/sst-test/my-sst-app3/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (events.js:314:20)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}
also this warning:
Copy code
WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0

YOUR TYPESCRIPT VERSION: 4.6.2
p
Yeah, the previous fix didn't quite solve it
j
@Pål Brattberg good to see you again! Are you still having this issue?
p
Good to be here @Frank! Yeah, still get the error locally whenever I save a new version of a lambda while using
sst start
f
@Pål Brattberg can you try installed it as a dev dependency and see if it work?
Copy code
npm install @typescript-eslint/eslint-plugin@latest --save-dev
@Dominik Dabrowski can you show me what’s in this file?
Copy code
/Users/doda/pr/sst-test/my-sst-app3/.sst/artifacts/admin-my-sst-app3-my-stack-Api-Lambda_GET_-/src/lambda.js
p
Doing that yields this on saving a new version:
Copy code
Functions: Building . src/sites/list.handler...
Functions: Done building . src/sites/list.handler (62ms)
=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.5.0

YOUR TYPESCRIPT VERSION: 4.6.2

Please only submit bug reports when using the officially supported version.

=============