-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Importing in sentry.client/server.js
causes Error: Aborted because ... is not accepted
error
#6428
Comments
Can you please share the entire error message? |
|
I cannot reproduce the problem with the instructions you provided. Please provide a minimal reproduction example. My suspicion is that this is not a problem with the SDK but rather a limitation by Webpack/Next.js depending on what you do in |
sentry.client/server.js
causes Error: Aborted because ./sentry.common.config.js is not accepted
error
sentry.client/server.js
causes Error: Aborted because ./sentry.common.config.js is not accepted
errorsentry.client/server.js
causes Error: Aborted because ... is not accepted
error
In my E.g. /**
* beforeSend Hook with data scrubbing
* @param {Event} event Sentry Event object available in the beforeSend hook
* @returns {Event} Modified event with scrubbed data
*/
export const beforeSend = (event) => {
const exception = scrubData(event.exception, keyBlacklist, scrubCallback);
// breadcrumbs only uses sentry properties, not dynamic properties from our codebase.No need to apply a list of blacklisted properties
const breadcrumbs = scrubData(event.breadcrumbs, null, scrubCallback);
const request = scrubData(event.request, keyBlacklist, scrubCallback);
return {
...event,
exception,
breadcrumbs,
request,
};
};
/**
* beforeSendTransaction Hook with data scrubbing
* @param {Event} event Sentry Event object available in the beforeSend hook
* @returns {Event} Modified event with scrubbed data
*/
export const beforeSendTransaction = (event) => {
// spans contain performance data which may include raw urls.
// Here, we must lookout for url values, e.g. "/[email protected]" or "/phone-number/reserve/9281929" and remove personal information
const spans = scrubData(event.spans, null, scrubCallback);
const breadcrumbs = scrubData(event.breadcrumbs, null, scrubCallback); // breadcrumbs only uses sentry properties, no need to apply a list of blacklisted properties
const request = scrubData(event.request, keyBlacklist, scrubCallback);
return {
...event,
spans,
breadcrumbs,
request,
};
}; Where scrubData is a method that traverses through all nested objects/array elements, and looks for blacklisted key names or applies data scrubbing on the primitive value. |
Unfortunately, this doesn't help debugging the issue you're describing. Please provide a minimal reproduction example we can clone or use a small Stackblitz example we can look at. |
Do you have a Stackblitz boilerplate that uses Next.js and Sentry? |
Sadly no. |
I think i narrowed it down a bit further.
export const beforeSend = (event) => event;
import * as Sentry from "@sentry/nextjs";
import { beforeSend } from "sentry.common.config";
Sentry.init({
// ...
beforeSend,
});
|
Ok I can reproduce now. Thank you! Putting this on our backlog. |
Great! Any idea why this happens? ESM/CJS issue? |
Not atm, most likely some webpack shenanigans. |
Any updates on this? I'm having the same issue |
@ForeshadowRU what SDK version are you on? |
I think this is fixed in the newest SDK + Next.js version. Feel free to ping us if that is not the case! |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/nextjs
SDK Version
7.21.0
Framework Version
Next.js v12.3.0
Link to Sentry event
No response
Steps to Reproduce
My Next.js project contains:
/sentry.server.config.js
/sentry.client.config.js
/sentry.common.config.js
<- my custom file having rules/hooks that both the server and client config shareWith the
/sentry.common.config.js
file, my terminal now throws:Error: Aborted because ./sentry.common.config.js is not accepted
errors.I'd guess that sentry reserves the right for all
sentry.*.config.js
files, where*
must be an accepted name and the file itself must initialize a sentry config.I fail to find the above assumption in the documentation and am curious as to how else I then should create this common file? Furthermore, I've found several feature request issues asking for the possibility of moving the config files in folders and not pollute the root directory. However, having a whole
/sentry
directory just for this single common config file seems unnecessary too.Expected Result
N/A
Actual Result
N/A
The text was updated successfully, but these errors were encountered: