Open benjamindulau opened 9 months ago
For the client event you shared: hello-travel.sentry.io/issues/4949583427/events/236fed44801a4b4f8b4ad78bd27886b2, you did not upload the needed source map. "Sourcemap reference" in the artifact indicates what file this source map file would require. In general it is the //# sourceMapURL=
comment at the end of the file. It is not in the uploaded artifacts.
As for the lambda event, would you mind also sharing a link? Thanks!
@lforst Yeah, that what we figured out after I posted the issue. I knew I got it working before!
It seems that there is something going on with some deploys not sending the sourcemaps for the client bundle. We're currently inspecting the issue on this...
As for the lambda handler, I'll get back at you on monday with more information (I'm on a break for the rest of the week). But if you take a look at the following screenshot, I suspect that we need to upload the /var/task/index.mjs
source bundle file which references the sourcemap along with the sourcemap....
But how can we do that using the sentry-cli
? I managed to upload the sourcemap, but don't know how to send the source code along with it in the same artifact bundle... Can you point me in the right direction about that?
Thanks!
@benjamindulau Correct. You always need to upload both, the generated file and its source map (so the corresponding index.mjs
for the lambda for example). Generally you just need to point the CLI to where your built files are located.
You are currently only pointing it to one file:
npx sentry-cli sourcemaps upload --org=hello-travel --project=remix --release=${release} --url-prefix="~/var/task" ./server/build/index.mjs.map
instead you should point it at the entire folder:
npx sentry-cli sourcemaps upload --org=hello-travel --project=remix --release=${release} --url-prefix="~/var/task" ./server/build
@lforst Already tried that in the past. Tried again and this seems to upload only sourcemap files:
@szokeasaurusrex Would you mind checking whether we're picking up .mjs files with sentry-cli sourcemaps upload
? If not we definitely should!
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/remix
SDK Version
7.93
Framework Version
7.79
Link to Sentry event
https://hello-travel.sentry.io/issues/4949583427/events/236fed44801a4b4f8b4ad78bd27886b2/
SDK Setup
Client side configuration
Server side (lambda) configuration:
Deploy flow
Scripts used in package.json:
npm run build
The script
bin/build-lambda-server.ts
creates a new build with esbuild (and sourcemap enabled) for our lambda function, something like:npm run deploy
const release = execSync("git rev-parse HEAD") .toString() .trim() .substring(0, 12);
// 1. .... build an archive for the lambda
// 2. Send both client & server bundle sourcemaps to Sentry // client bundle sourcemap is handled by sentry execSync(
npx sentry-upload-sourcemaps --org hello-travel --project remix --release ${release} --urlPrefix "~${remixPublicPath}"
, { cwd: paths.appDir }, ); // server bundle sourcemap is sent manually execSync(npx sentry-cli sourcemaps upload --org=hello-travel --project=remix --release=${release} --url-prefix="~/var/task" ./server/build/index.mjs.map
, { cwd: paths.appDir, }, );// 3. other stuff not relevant to sentry (like updating lambda function code, cleanup, etc...)