-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rollup-plugin] - Sourcemaps failing to upload when directory containing them has been deleted prior to upload happening #1053
Comments
It would be great if I could set something like an |
Hi @joekrump, thanks for reaching out! Just to clarify, you believe the files in Your suggestion of setting an Are you able to tell what folder those assets that were successfully uploaded were located in? Also, would you mind sharing your |
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
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
import { defineConfig } from 'vite';
import rubyPlugin from 'vite-plugin-ruby';
import vue from '@vitejs/plugin-vue';
import svgLoader from 'vite-svg-loader';
import fullReload from 'vite-plugin-full-reload';
import { brotliCompress } from 'zlib';
import { promisify } from 'util';
import gzipPlugin from 'rollup-plugin-gzip';
import honeybadgerRollupPlugin from '@honeybadger-io/rollup-plugin';
const HONEYBADGER_API_KEY = JSON.stringify(process.env.HONEYBADGER_FRONTEND_API_KEY)?.trim();
const HONEYBADGER_REVISION = JSON.stringify(process.env.SOURCE_VERSION)?.trim();
const ENVIRONMENT = JSON.stringify(process.env.ENVIRONMENT)?.trim();
// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths, import/extensions
import { RESOLUTION_ALIASES } from './config/vite';
const plugins = [
// Do a full reload when changes are made to files with paths that match these.
fullReload(['app/views/**/*']),
rubyPlugin(),
svgLoader(),
vue(),
];
const rollupPlugins = [];
// Only compress assets in non-development environments.
if (process.env.VITE_RUBY_MODE && process.env.VITE_RUBY_MODE !== 'development') {
const honeybadgerPluginOptions = {
apiKey: process.env.HONEYBADGER_FRONTEND_API_KEY,
assetsUrl:
process.env.ENVIRONMENT === 'staging'
? 'https://staging-asset-url.com'
: 'https://production-asset-url.com',
revision: process.env.SOURCE_VERSION,
};
// used for uploading sourcemaps to honeybadger to allow for better debugging
rollupPlugins.push(honeybadgerRollupPlugin(honeybadgerPluginOptions));
const brotliPromise = promisify(brotliCompress);
plugins.push(
gzipPlugin({
customCompression: (content) => brotliPromise(Buffer.from(content)),
fileName: '.br',
})
);
}
export default defineConfig({
build: {
sourcemap: process.env?.VITE_RUBY_MODE === 'development' ? 'inline' : 'hidden',
rollupOptions: {
plugins: rollupPlugins
}
},
resolve: {
alias: RESOLUTION_ALIASES,
},
define: {
HONEYBADGER_API_KEY,
ENVIRONMENT,
HONEYBADGER_REVISION,
},
plugins,
}); |
Hey @joekrump, thanks for the update and the config file. I have a question:
Additionally, a comment on your
Finally, I think I have all I need to try this on my side and see if I can reproduce your issue and debug further. |
Re |
The files in |
Hey @joekrump, I created a very simple vite app and deployed on Heroku. I couldn't reproduce the errors shown above. In any case, I will go ahead and create an |
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. |
Here it is.
|
@subzero10 something I just caught regarding the upload errors. Error output:
Those failed files all seem to correspond to the I can see that the
In my build output dir I do NOT have any
UpdateWhen comparing sourcemap.source between what shows up for the
|
So I'm starting to think that the root cause of the issue might be something to do with what I've outlined in this other issue: ElMassimo/vite_ruby#358 |
If that's the case, the ignorePath could still be helpful, but what might be even more helpful might be something like an In my case, I'd want to have a guard that did something like |
Hey @joekrump, this is great info! I am working already on adding support for |
💯 That would be a great default to add and would fix my issue I think. |
Hey @joekrump, we just released Thank you for all your help on this! |
🙌🏻 Amazing! Thanks for you work on this @subzero10 and @BethanyBerkowitz |
What are the steps to reproduce this issue?
vite build
in a Heroku Nodejs buildpackWhat happens?
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?
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
The text was updated successfully, but these errors were encountered: