honeybadger-js: [rollup-plugin] - Sourcemaps failing to upload when directory containing them has been deleted prior to upload happening
What are the steps to reproduce this issue?
- Set up an app which runs
vite build
in a Heroku Nodejs buildpack - Have the build command run in the buildpack
What happens?
- Most sourcemap files that are output are uploaded
- Sourcemap files that are found in the ephemeral
tmp/build_...
directory are not uploaded because they no longer exist, even though their entries show up in the bundle object which this plugin reads entries from. The build fails because this results in an Error being thrown.
What were you expecting to happen?
- No issues. Sourcemaps are uploaded successfully.
Any logs, error output, etc?

Any other comments?
What versions are you using?
Operating System:
Building on the Heroku-20 stack
-----> Using buildpacks:
1. heroku/nodejs
2. heroku/ruby
Package Name: @honeybadger-io/rollup-plugin
Package Version: 5.1.5
Browser Version: N/A
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 16 (6 by maintainers)
Commits related to this issue
- feat: add ignorePaths option Fixes: #1053 — committed to honeybadger-io/honeybadger-js by subzero10 a year ago
- chore: add test for empty sourcesContent Refs: #1053 — committed to honeybadger-io/honeybadger-js by subzero10 a year ago
- chore: update README Refs: #1053 — committed to honeybadger-io/honeybadger-js by subzero10 a year ago
- chore: use picomatch to match against glob patterns Refs: #1053 — committed to honeybadger-io/honeybadger-js by subzero10 a year ago
- chore: pass array of paths to picomatch, remove regex refs Refs: #1053 — committed to honeybadger-io/honeybadger-js by subzero10 a year ago
- chore: pass array of paths to picomatch, remove regex refs Refs: #1053 — committed to honeybadger-io/honeybadger-js by subzero10 a year ago
Hey @joekrump, we just released
v5.4.0
of the@honeybadger-io/rollup-plugin
with aningorePaths
option and an algorithm improvement to skip source maps that have emptysourcesContent
.Thank you for all your help on this!
cc @BethanyBerkowitz
Here it is. Note that it doesn’t even create a static page. I just added the nodejs buildpack on Heroku and made sure that the build step is executed:
💯 That would be a great default to add and would fix my issue I think.
If that’s the case, the ignorePath could still be helpful, but what might be even more helpful might be something like an
ignoreSourcemapFn
or something like that which would allow someone to run some custom check on a sourcemap before determining it’s something that should be uploaded or not. What do you think?In my case, I’d want to have a guard that did something like
JSON.parse(sourcemap.source).sourcesContent !== []
Thanks @subzero10! Any chance you can make that sample app open source that sample vite app? It might help me out and others in the future.
The files in
tmp
get copied over into mypublic
directory and so all the files will end up existing there.Re
vite.config.ts
. I’ve definedHONEYBADGER_API_KEY
, etc because they are used elsewhere in some other js code where I’m callingHoneybadger.configure()
when my vue app first mounts.Hey @BethanyBerkowitz sorry for the delay in getting back to you. I think the reason things are ending up in tmp is because the build is happening in a Heroku buildpack which is ephemeral and by the time the upload attempts to happen, it is no longer available.
It’s a similar problem as to what is described in this SO post: https://stackoverflow.com/questions/73552104/cant-access-heroku-tmp-build-sha-build-files-in-github-action-once-build-has
.js.map
files that were successfully uploaded existed in my app’spublic/vite/assets
directory.So I think that what is happening is that because the build happens in this ephemeral Heroku buildpack, that in the output bundle file is created (which is read by this rollup plugin), it lists that there are
.js.map
files within thetmp
directory (which there were at the time of the build), however, by the time the sourcemap upload happens, those files and that entire directory have been cleaned up and only the files inpublic/vite/assets
remain.vite.config.ts
:Hi @joekrump, thanks for reaching out! Just to clarify, you believe the files in
tmp/
should not be uploaded, correct? I want to understand why they’re even being generated since I don’t see that happening when building locally with Vite. When I build, it looks like I just get assets in/dist/assets
. Do you know if this is a Heroku thing?Your suggestion of setting an
ignorePath
seems very reasonable, I’m just wondering if dumping files into/tmp
and then deleting them is expected behavior… if so, perhaps we should exclude those files by default rather than adding additional config.Are you able to tell what folder those assets that were successfully uploaded were located in?
Also, would you mind sharing your
vite.config.js
just in case there’s anything relevant?It would be great if I could set something like an
ignorePath
regex or glob which I could set to"tmp/build_*"
in the plugin config options. That would then be able to be used inisSourcemap
: https://github.com/honeybadger-io/honeybadger-js/blob/a10f68655e4949e32f0fbe0ed8cdb763232d6497/packages/rollup-plugin/src/rollupUtils.ts#LL21C25-L21C25