Skip to content
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

next-axiom should not treat NEXT_REDIRECT as errors #219

Closed
empz opened this issue Aug 6, 2024 · 5 comments · Fixed by #253
Closed

next-axiom should not treat NEXT_REDIRECT as errors #219

empz opened this issue Aug 6, 2024 · 5 comments · Fixed by #253

Comments

@empz
Copy link

empz commented Aug 6, 2024

When wrapping route handlers with withAxiom, redirects using App Router's redirect() are caught and treated as errors. If this library claims to be compatible with the App Router, it should understand this is not an error. Same thing with notFound().

By the way, is this being maintaned at all? Last release was months ago.

@dasfmi
Copy link
Collaborator

dasfmi commented Aug 6, 2024

Hi, @empz thanks for you feedback. Yes next-axiom is very much active, there has not been changes in a while thats why there was no releases. We are planning a release soon with the changes from #218, I will also take the bug you mentioned into account.

@ReDev1L
Copy link

ReDev1L commented Dec 12, 2024

Hi, @empz thanks for you feedback. Yes next-axiom is very much active, there has not been changes in a while thats why there was no releases. We are planning a release soon with the changes from #218, I will also take the bug you mentioned into account.

Hi, those errors and status code overriding affects DX seriously, any plans to fix that?
https://github.com/axiomhq/next-axiom/blob/main/src/withAxiom.ts#L131-L151

dasfmi added a commit that referenced this issue Dec 13, 2024
We catch all errors and set statusCodes to 500s. This changes the
behavior to set the statusCodes to 404 or one of 307/308.
This fixes #219
@dasfmi
Copy link
Collaborator

dasfmi commented Dec 13, 2024

I have created a PR to catch NEXT_NOT_FOUND and NEXT_REDIRECT to handle the status codes, but not sure what is the expect type of the log, its currently still an error, what's your thoughts on this?

also, is there any other catch errors we should catch?

@ReDev1L
Copy link

ReDev1L commented Dec 13, 2024

I think it's debug level for redirects, because it's not an error.
Dunno about not found, for someone it's an error, but for me debug will be ok.

If it was a plugin, not a wrapper - those levels could go to the some sort of config

@dasfmi
Copy link
Collaborator

dasfmi commented Dec 13, 2024

updated my PR with default values for both errors and a way to override those values through the config object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants