Comments (4)
You are right, it won't. Turns out, I had another plugin (serverless-sentry
) installed that was duplicating the upload and causing the issue. My bad, sorry for the confusion
from sentry-javascript-bundler-plugins.
I am assuming you are uploading source maps for 87 lambdas in quick succession and you are running into our rate limits. Can you try somehow adding a sleep in between the individual builds as a workaround? 1-2 seconds between each build should probably be enough.
I am not sure whether we will increase the rate limit on our API for this use case as it is a bit special I'd say. If the esbuild plugin doesn't work for your use-case you can also use Sentry CLI.
from sentry-javascript-bundler-plugins.
Sorry @lforst -- I need you guys to do it. I tried to fork/test, but this project is using an EOL version of node that my OS won't install, and trying to use a local version of node-18 gives errors like this:
sentry-javascript-bundler-plugins main @ 6fd1363 ∽ 30s ❄️ nix-shell-env❯ yarn build
yarn run v1.22.22
$ nx run-many --target=build --all
✖ nx run @sentry/babel-plugin-component-annotate:build
$ rimraf ./out && run-p build:rollup build:types
$ rollup --config rollup.config.js
$ tsc --project types.tsconfig.json
src/index.ts → dist/esm/index.mjs, dist/cjs/index.js...
created dist/esm/index.mjs, dist/cjs/index.js in 1.4s
src/index.ts(136,15): error TS2345: Argument of type 'string | null | undefined' is not assignable to parameter of type 'string | null'.
Type 'undefined' is not assignable to type 'string | null'.
The fix should be simple, but I can't build/test it. Given this is related to your API limits, can I get some help from you guys to test this? This should be pretty close to what we want:
Replace:
await upload(buildArtifacts);
with:
const chunkSize = 35;
const oneMinute = 60 * 1000; // in milliseconds
for (let i = 0; i < buildArtifacts.length; i += chunkSize) {
const currentChunk = buildArtifacts.slice(i, i + chunkSize);
const timeLeft = oneMinute - (Date.now() % oneMinute);
await upload(currentChunk);
const sleepTime = Math.max(0, timeLeft - 50); // add some extra 50ms to account for timing inaccuracies
await new Promise((resolve) => setTimeout(resolve, sleepTime));
}
Full code for that function
function esbuildDebugIdUploadPlugin(
upload: (buildArtifacts: string[]) => Promise<void>
): UnpluginOptions {
return {
name: "sentry-esbuild-debug-id-upload-plugin",
esbuild: {
setup({ initialOptions, onEnd }) {
initialOptions.metafile = true;
onEnd(async (result) => {
const buildArtifacts = result.metafile ? Object.keys(result.metafile.outputs) : [];
// sentry API appears to have a rate limit of 40 requests per minute -- chunk and finish in batches
const chunkSize = 35;
const oneMinute = 60 * 1000; // in milliseconds
for (let i = 0; i < buildArtifacts.length; i += chunkSize) {
const currentChunk = buildArtifacts.slice(i, i + chunkSize);
const timeLeft = oneMinute - (Date.now() % oneMinute);
await upload(currentChunk);
const sleepTime = Math.max(0, timeLeft - 50); // add some extra 50ms to account for timing inaccuracies
await new Promise((resolve) => setTimeout(resolve, sleepTime));
}
});
},
},
};
}
from sentry-javascript-bundler-plugins.
Two things:
- I don't think this change will work as you expect because I think you are invoking esbuild 87 times, meaning the onEnd calls are separate and timeouts won't matter. Also, the rate limit is not because we are uploading too many buildArtifacts at once, it is because we are hitting the API too often.
- We will likely not add an intentional slowdown to clients in order to get around our rate limits. I would like to ask you to adjust your build system instead.
from sentry-javascript-bundler-plugins.
Related Issues (20)
- `sourcemaps.rewriteSources` doesn’t apply new source value HOT 8
- Upload sourcemaps for multiple environments HOT 10
- `isOlderThan` is not a function HOT 9
- [Help]: Change project release details for uploaded sourcemaps HOT 2
- Dont log warnings when certain features are disabled
- Esbuild Crash Warning HOT 3
- `moduleMetadata` and or `moduleMetadataIntegration` do not work with `vite-plugin` HOT 6
- Source Maps not loading on sentry HOT 15
- Unclear how to make Sentry work with Vite + React sourcemaps HOT 4
- Nuxt with sentryVitePlugin: Cannot read properties of undefined (reading 'startsWith') HOT 5
- Vite plugin logging to stdout instead of stderr HOT 2
- Cannot build with Vite and latest sentry plugin version HOT 7
- sentry does not consider sourcemaps HOT 5
- esbuild plugin causing error in Nx Angular CLI (angular 17)
- `filesToDeleteAfterUpload` is deleting files before upload in latest versions HOT 4
- can not disable soucemap HOT 3
- sentry/webpack-plugin upload sourcemap oom HOT 5
- Sentry sourcemap use `@vitejs/plugin-legacy` and `@sentry/vite-plugin` conflict. HOT 8
- JavaScript heap out of memory, after adding Sentry to my Vite-React Project - GitLab HOT 1
- Invalid org token in Vite build HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-javascript-bundler-plugins.