-
-
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
Attempted import error: 'withSentry' is not exported from '@sentry/nextjs'. #3673
Comments
Hi @HarshaDW, I just checked and could not reproduce it. Could you provide a reproducible example (preferably a repo) for us to confirm? |
@lobsterkatie, @onurtemizkan,
An example of using in API:
next.config.js:
sentry.client.config:
sentry.server.config:
After next dev || next build: Currently, I was managed to find a soulition with a capture exepction. As for me, this isn't convenient solution.:
|
Hi @mavlikwowa, I still can't reproduce the issue using the snippets you provided. Could you create a repo if possible?
And, are you using the global installation of next while running your app? I'm just wondering whether there is a global/local conflict that could lead to this issue. |
GA, @onurtemizkan
Perhaps, it can help us to resolve this probem. |
Thanks a lot for the reproduction @mavlikwowa. |
What was the resolution for the issue? I am running into this as well. |
Hitting this issue as well. |
@mavlikwowa - circling back around to this. I checked out your repro repo, and one thing I noticed is that your I'll also say that I've never seen a handler function called directly. Normally nextjs calls the handler, once a request has been made to the handler's route, and the SDK works based on that assumption. Is there a reason you're calling it directly? @njfix6 @zkhalapyan - Are your nextjs apps set up the same way as in @mavlikwowa's repo? If not, could either of you post a reproduction of your setup? |
@lobsterkatie ours is under pages, it's the same setup that next.js autogens through the script, so pretty it's at least setup the the way they want it to be setup. I wonder if next.js does some pruning with NPM packages and ends up cutting off sentry for some reason? |
Wouldn't it complain that it can't find sentry at all in that case, though? Are you able to create a small repro of the error? If not, it'd be helpful to see your |
I played around again with the repro in the related issue here, and in that case, I think I've diagnosed the problem. @njfix6 @zkhalapyan, are you importing anything from |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
I've also fixed this problem removing the exports from the |
Here is my current implementation pattern and editor setup: My Tips:
import { FooResponse, fetchFoo } from "pages/api/_foo"
export default () => {
const { data } =useSWR(key, fetchFoo)
return <>...</>
} VSCode: "explorer.experimental.fileNesting.patterns": {
"*.ts": "$(capture).js, _$(capture).ts, $(capture).d.ts, $(capture).test.ts"
} |
TIL! Thanks for sharing your setup, @ka2n! |
It sounds like we've identified the problem, so I'm going to close this. Please let us know if that's not the case. Cheers! |
Package + Version
Description
Describe your issue in detail, ideally, you have a reproducible demo that you can show.
Attempted import error: 'withSentry' is not exported from '@sentry/nextjs'.
Though exported in handlers.ts enabled import into api/index handler.
Same with
import * as Sentry from "@sentry/nextjs";
The text was updated successfully, but these errors were encountered: