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

request error Context conflict #1984

Closed
EduardoMateos opened this issue Apr 11, 2023 · 11 comments
Closed

request error Context conflict #1984

EduardoMateos opened this issue Apr 11, 2023 · 11 comments

Comments

@EduardoMateos
Copy link

Environment

production and dev

Reproduction

https://stackblitz.com/edit/nuxt-issue-20070

It is also related to the package "@nuxtjs/i18n" and "useCookie".

1. On a clean nuxt 3 project, install:
"@nuxtjs/i18n": "^8.0.0-beta.10"

2. Create global middleware like this:

export default defineNuxtRouteMiddleware(() => {
  const session = useCookie<string>("uuidSession");
});

3. Use siege and gtimeout to send multiple concurrent requests:
brew install siege
brew install coreutils
gtimeout 30 siege -c 5 http://localhost:3000

then sometimes I will get the error:
[nuxt] [request error] [unhandled] [500] Context conflict

Describe the bug

Error appears in production and local logs:
[nuxt] [request error] [unhandled] [500] Context conflict
image

Additional context

No response

Logs

[nuxt] [request error] [unhandled] [500] Context conflict                                                                                                             12:51:26
  at checkConflict (./node_modules/unctx/dist/index.mjs:6:13)  
  at Object.call (./node_modules/unctx/dist/index.mjs:31:7)  
  at contextCaller (./node_modules/nuxt/dist/app/nuxt.js:61:26)  
  at Hookable.callHookWith (./node_modules/hookable/dist/index.mjs:198:20)  
  at Hookable.nuxtApp.hooks.callHook (./node_modules/nuxt/dist/app/nuxt.js:64:63)  
  at ./.nuxt/dev/index.mjs:723:32  
  at processTicksAndRejections (node:internal/process/task_queues:96:5)  
  at async ./.nuxt/dev/index.mjs:394:22  
  at async Object.handler (./node_modules/h3/dist/index.mjs:1247:19)  
  at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:1322:7)
@c-schwan
Copy link

@kazupon can you please provide a workaround?

@hahatulk
Copy link

same! @kazupon please we need your help, it is blocking issue

@c-schwan
Copy link

c-schwan commented Apr 12, 2023

@kazupon useCookie is not the issue, i tried without and the same error happened

@EduardoMateos
Copy link
Author

I don't know how to further debug the problem. I hope someone can help. The problem is affecting us in production and we urgently need to solve it @kazupon

@hahatulk
Copy link

@kazupon useCookie is not the issue, i tried without and the same error happened

For me removing useCookie helps, but I need it

Copy link
Collaborator

kazupon commented Apr 13, 2023

Hi!
Thank you for your reporting!

I would like you to sepelate this issue if this issue can be reproduced with your cusomt module without using nuxt i18n first. 🙏
If so, you should report it to nuxt as an issue, as it is probably a problem with useCookie.

@c-schwan
Copy link

c-schwan commented Apr 13, 2023

Hi! Thank you for your reporting!

I would like you to sepelate this issue if this issue can be reproduced with your cusomt module without using nuxt i18n first. 🙏 If so, you should report it to nuxt as an issue, as it is probably a problem with useCookie.

👍 thx @kazupon after digging deeper it stuck in the app:render hook. The unctx is checking the currentContext vs instance ctx and throws an 500 error. I dont think ist ein i18n issue

@c-schwan
Copy link

@EduardoMateos

can you please try below Nuxt 3.3.2?

See: nuxt/nuxt#19753

@EduardoMateos
Copy link
Author

@c-schwan you're right. in version 3.3.0 it doesn't happen.

Captura de pantalla 2023-04-13 a las 7 26 09

@elzodxon
Copy link

How can we resolve it?

@EduardoMateos
Copy link
Author

fixed: nuxt/nuxt#20510

version 3.4.3

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

No branches or pull requests

5 participants