https://serverless-stack.com/ logo
#help
Title
# help
v

vinash

12/20/2021, 7:49 PM
Hi, I'm new to sst and going through the (great) serverless stack guide and witness some strange behavior. Whenever I add an API (get, list, delete, etc.), after deployment which is triggered automatically by "sst start", when I trigger the function through curl, sst start fails with the error below:
Copy code
TypeError: Cannot read properties of undefined (reading 'send')
    at Object.send (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/cli/FunctionBuilder.js:57:21)
    at WS.handleRequest (/Users/********/Applications/notes/node_modules/@serverless-stack/cli/scripts/start.js:253:21)
    at WS.<anonymous> (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:100:41)
    at Generator.next (<anonymous>)
    at /Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:4:12)
    at WS.handleMessage (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:62:16)
    at WebSocket.<anonymous> (/Users/********/Applications/notes/node_modules/@serverless-stack/core/dist/runtime/ws.js:59:49)
    at WebSocket.emit (node:events:390:28)
Then when I run "sst start" again everything works just fine. And that sst start from the commandline states that no changes were deployed. If I add another api when sst start is not running and then do sst start which triggers the deployment everything works fine as well. So it seems like there is some state in memory in the local development server that doesn't work well when adding new API's. Any ideas what's causing this?
f

Frank

12/21/2021, 8:45 PM
Lemme pull in Dax, he’s more familiar with the watcher part. @thdxr I followed @vinash’s step but was not able to reproduce the issue. Looking at the error message, it seems to come from this snippet:
Copy code
function send(id, event) {
        const func = ctx.funcs[id];
        return func.send(event);
    }
Can you think of any corner where the function isn’t in
ctx
?
t

thdxr

12/22/2021, 12:30 PM
Yes, looks like I'm forgetting to reload the functionBuilder on a stacks deploy
fixing now thanks for reporting @vinash
v

vinash

12/22/2021, 10:11 PM
Happy to assist and thanks for the quick response
f

Frank

12/23/2021, 3:50 AM
👍
t

thdxr

12/27/2021, 11:58 PM
Fixed in 0.55.0 @vinash