I just realized the past dozen or so of our releas...
# help
s
I just realized the past dozen or so of our releases haven’t published source maps to Sentry 😕 something must’ve changed with SST in how it builds source files, or maybe executes esbuild plugins?
yep,
config/esbuild.js
is not getting called
this plugin was critical for us to organize source & source maps in the proper hierarchy for Sentry. what should I do?
t
s
yessir!
Copy code
Esbuild configs must now be defined as part of function props, cannot set them in sst.json
hmm, should this work? in my
setDefaultFunctionProps
call?
Copy code
bundle: {
      esbuildConfig: {
        plugins: 'config/esbuild.js',
      },
    },
my cron definition suddenly throws an error
Copy code
at new CoreStack (/Volumes/SuperData/Sites/reelcrafter/v2-microservices/infra/core/stack.ts:53:7)
no real details, just “Error: There was a problem transpiling the Lambda handler”
if I put
bundle: {}
in that cron function definition, it passes.. but then throws an error at another
sst.Function
definition.
t
It errors for sst start or deploying?
s
deploy
and start too, I think (I’ll double-check)
nope, just deploy
oh wait.. it just bombed on me
Copy code
2034d460-71fc-465e-8b89-89dbb6db3052 REQUEST dev-microservices-api-files-setTags [lambda/rest/functions/set-tags.main] invoked by API PUT /media/f2ea5fd8-a17c-4441-b120-1c94f84b6c70/tags

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:153:33)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
so yeah, crashes start mode too
t
can I see your esbuild config?
s
sure thing
t
ah that's the one other thing we changed
you just export the plugins array now instead of nesting in an obj
Copy code
module.exports = [...]
s
ohhh.. gotcha. ok, one sec
deploying…
man, life without source maps is dreadful 😆
t
err a is undefined on line:81938
s
haha. or line 1, column 83719827
dang, didn’t work. one sec
I mean, it didn’t bomb on me. but I see no sourcemaps uploaded.
.build/sourcemaps
wasn’t created
t
is metafile defined?
s
checking. I put a console.log in there to see if it’s even getting executed
t
ohh I think we have sourcemaps going inline now (was what worked for local dev)
need to fix that for deployment
s
oh.. crap. any suggestions on what I should do for the moment?
t
I'm fixing it right now
s
amazing. thank you!
t
Copy code
sst update 0.55.2-next.12
lmk if that works
s
ok, trying
oops.. forgot that doesn’t work with yarn yet
gotta edit package.json manually
ok, deploying
got a
metafile is undefined
Copy code
module.exports = [
  {
    name: 'create-sourcemaps',
    setup(build) {
      build.onEnd(({ metafile }) => {
        console.log('###### metafile:', metafile);
t
hm weird because we build with metafile: true
s
strange
my format is correct for esbuild.js, right? export array of
{ name: string; setup: (build) => void }
?
t
I've never written an esbuild plugin so not sure but seems right
s
lemme not destructure that setup callback argument. maybe something changed there
what the heck. the setup callback is being passed
{ errors: [], warnings: [] }
I dunno what this is
any suggestions on how to troubleshoot this?
something must’ve changed with esbuild: https://esbuild.github.io/plugins/#on-end
looks like all onEnd gets is a report
oh wait!
If you want to be able to inspect the build graph, you should enable the metafile setting on the initial options and the build graph will be returned as the metafile property on the build result object.
is this where the
define
property you guys have in esbuildConfig comes in? hm
t
The thing is metafile setting is turned on...
s
oh.. strange. esbuild doesn’t seem to see it. from what I understand, a metafile object would exist if the option is on
t
oh wait it's not turned on!
I'll fix it now
s
aha! 🙂
t
try
Copy code
0.56.2-next.4
s
🤞
I do see a
.build/sourcemap
folder so this looks promising
@thdxr YES! it works. thank you! 🏆
t
hooray
will ship this now
s
amazing