Uncaught error when axios retry is used #1624
Replies: 6 comments 4 replies
-
I'm currently experiencing the same error but with a different Nuxt configuration. Did you discover any workarounds that can be done in userland i.e. that don't require patching the module? |
Beta Was this translation helpful? Give feedback.
-
@rico-ocepek I also encountered this issue while setting up the auth for local login. For workarounds, use @nuxt/auth which is the previous version on nuxt auth(4.9.1) instead of @nuxt/auth-next. |
Beta Was this translation helpful? Give feedback.
-
We recently upgraded axios, can you please try the latest auth-next and see if this is resolved? |
Beta Was this translation helpful? Give feedback.
-
Also, for SSR, please check everything listed in #1197 |
Beta Was this translation helpful? Give feedback.
-
Hello, I have the same problem with a local schema (but only when the user is not connected), I tried to upgrade to version 5.0.0-1643023090.140d3d1 (https://www.npmjs.com/package/@nuxtjs/auth-next/v/5.0.0-1643023090.140d3d1) nuxtjs/auth-next: 5.0.0-1643023090.140d3d1 |
Beta Was this translation helpful? Give feedback.
-
module: Same issue on my end, but I'm not using Issue doesn't occur when I import axios explicitly for calls, but does when I use nuxt's I've checked everything in #1197, I don't think any of them apply to my use case. On my end it seems to occur when I make requests with custom headers that don't include eg this throws the error: $axios.get(
url,
{
headers: {
"Custom-Header": "val"
}
}
) this doesn't: $axios.get(
url,
{
headers: {
"Custom-Header": "val",
common: {},
}
}
) Why don't we implement @adambullmer's changes in #1624 (comment)? Seems like checking for parent key's existence is a good idea regardless? |
Beta Was this translation helpful? Give feedback.
-
Version
module:
5.0.0-1613647907.37b1156
nuxt:
2.14.12
Nuxt configuration
mode:
Nuxt configuration
Reproduction
Reproducible example: https://codesandbox.io/s/busy-gareth-vewyu
What is expected?
When the native @nuxtjs/axios module is configured for retrying, the auth module should still work on a retried request.
What is actually happening?
An error is thrown on SSR regarding checking the Authorization header. If using nuxt error pages, this will instead render an error page instead of the intended page. This is due to getting a different type config object structure in the headers.
Steps to reproduce
In the above example, just visiting the home page directly by address bar or refreshing the page will yield the server error.
Additional information
I believe the root of the bug is here, where deep object accessors don't check that the previous key exists: https://github.com/nuxt-community/auth-module/blob/dev/src/inc/request-handler.ts#L126
I've made a patch locally to not be blocked by a release:
Checklist
Steps to reproduce
What is expected?
What is actually happening?
Performance analysis?
n/a
Beta Was this translation helpful? Give feedback.
All reactions