`sst start` crashes upon the first HTTP API reques...
# help
s
sst start
crashes upon the first HTTP API request
Copy code
TypeError: Cannot read property 'map' of undefined
    at Object.build (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:163:33)
    at Object.build (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:12:25)
    at Server.trigger (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/server.js:173:53)
    at Server.invoke (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/server.js:141:21)
    at WS.handleRequest (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/cli/scripts/start.js:307:33)
    at WS.handleMessage (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/ws.js:90:37)
    at WebSocket.<anonymous> (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/ws.js:50:49)
    at WebSocket.emit (events.js:400:28)
    at WebSocket.emit (domain.js:475:12)
    at Receiver.receiverOnMessage (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/ws/lib/websocket.js:1008:20)
I have
"type": "module"
in my root package.json, and I’ve set
bundle.format
to
'esm'
. I’m pretty sure this is related to one of both of these settings
hmm. yeah, disabling both of these fixes it
t
let me see
ok what's going on is the build is failing and the code to print our errors is actually failing too
Copy code
} catch (e: any) {
        return (e as esbuild.BuildResult).errors.map((e) => ({
          location: {
            file: e.location?.file || path.join(opts.srcPath, file),
            column: e.location?.column,
            line: e.location?.line,
            length: e.location?.length,
          },
          message: e.text,
        }));
      }
that's the map that's failing
can you try
yarn sst build
- it might print out the error
s
I gotta jet in a bit, but I’ll revisit this when I can later today and let you know
t
cool
s
I won’t forget about this 🙂 today is a little bit on fire
@thdxr ok! whew. I finally have time to revisit this. so,
sst build
yields this:
Copy code
Using stage: dev
Preparing your SST app
Synthesizing CDK
Building function lambda/auth/cognito-email-sender.main

Error: There was a problem transpiling the Lambda handler:
    at Object.bundle (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/handler/node.js:213:23)
    at Object.bundle (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/core/dist/runtime/handler/handler.js:19:16)
    at new Function (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/node_modules/@serverless-stack/resources/src/Function.ts:361:39)
    at setupAuth (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/infra/core/auth.ts:151:30)
    at new CoreStack (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/infra/core/stack.ts:82:22)
    at Object.main (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/infra/index.ts:69:21)
    at Object.<anonymous> (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/.build/run.js:94:16)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)

There was an error synthesizing your app.
t
weird seems like esbuild is printing a blank error
can you try the following
npx esbuild --target=esnext --platform=node --bundle  --format=esm --outfile=output.js  ./lambda/auth/cognito-email-sender.ts
s
Copy code
$ npx esbuild --target=esnext --platform=node --bundle  --format=esm --outfile=output.js  ./src/lambda/auth/cognito-email-sender.ts

  output.js  17.9mb ⚠️

⚡ Done in 731ms
t
and this works if you take out format: esm?
s
yeah
t
is this 0.60.2 or 0.60.4
s
0.60.2
t
can you try with 0.60.4?
s
sure, gimme a few
crashes 😞
same error
f
Hey @Sam Hulick, are you still getting the same issue?
s
@Frank last I checked, yeah. and I haven’t updated SST or anything. I’m on 0.60.4