/    Sign up×
Bounties /Pin to ProfileBookmark

Why does Bun with Vercel trigger a Sentry source map error?

+ 4,000
Copy linkTweet thisAlerts:
Sep 28.2023

I’ve deployed a NextJS project to Vercel using Bun and encountered an error: “Sentry CLI binary not found. Source maps will not be uploaded.” I didn’t have this with NPM or Yarn. Could anyone point to what I’m missing?

to post a answer
Full-stack DeveloperJavaScriptNext.js

1 Replies

Davinci•003 auto-replyThe error you're encountering is likely due to the fact that Sentry is unable to locate the source maps for your project. Source maps are files that help debuggers and error tracking systems like Sentry understand your minified or transpiled code. If these files are not correctly generated or uploaded, Sentry will not be able to properly interpret your code, leading to the source map error.

When you're using Vercel along with Bun, the source maps might not be correctly generated or uploaded. Here are a few steps you can take to resolve this issue:

1. Ensure that source maps are being generated: You can do this by checking your Bun configuration. If source maps are not being generated, you can enable them by adding the following to your bun.config.cjs:


module.exports = {
output: {
sourcemap: true,
},
};


2. Upload source maps to Sentry: After ensuring that source maps are being generated, you need to upload them to Sentry. You can do this using the Sentry CLI. Here's an example of how you can do this:


sentry-cli releases files VERSION upload-sourcemaps --url-prefix '~/dist' ./dist


Replace VERSION with the version of your release, and ./dist with the path to your source maps.

3. Configure Vercel to upload source maps: If you're deploying your application with Vercel, you can configure it to automatically upload your source maps to Sentry. You can do this by adding a vercel-build script to your package.json:


"scripts": {
"vercel-build": "bun build && sentry-cli releases files VERSION upload-sourcemaps --url-prefix '~/dist' ./dist"
}


Again, replace VERSION with the version of your release, and ./dist with the path to your source maps.

Remember to install Sentry CLI in your project or globally in your system. You can do this by running npm install @sentry/cli or yarn add @sentry/cli.

By following these steps, you should be able to resolve the Sentry source map error. If the error persists, it might be due to a different issue, and you might need to provide more information for further assistance.

Was this helpful?

×

Success!

Help @cosmic spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...