Hi, I'm new to sst and going through the (great) ...
# help
v
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
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
Yes, looks like I'm forgetting to reload the functionBuilder on a stacks deploy
fixing now thanks for reporting @vinash
v
Happy to assist and thanks for the quick response
f
👍
t
Fixed in 0.55.0 @vinash