nitro icon indicating copy to clipboard operation
nitro copied to clipboard

503 Server Unavailable issue (mostly on windows)

Open pi0 opened this issue 2 years ago • 14 comments

Related:

  • https://github.com/unjs/nitro/issues/1338
  • https://github.com/unjs/nitro/issues/310
  • https://github.com/unjs/nitro/issues/305
  • https://github.com/nuxt/nuxt/issues/15188
  • https://github.com/nuxt/nuxt/issues/22150

Fix attempts:

  • https://github.com/unjs/nitro/pull/1115

This issue has been mentioned by several users (mostly on Windows) that the dev server socket might go unavailable with 503 when having concurrency.

Right now there is no solid minimal reproduction with Nitro alone in order to isolate and resolve the root cause of the issue but it is certainly a valid issue that has been reported several times and needs to be resolved.

pi0 avatar Jul 17 '23 13:07 pi0

@pi0 Pooya - just to update, i'm using mac and windows both, getting this on both of them

mrniamster avatar Jul 17 '23 16:07 mrniamster

Related: I am planning to replace old http-proxy used in dev server with a better implementation. I will try to reproduce the issue with old package anyway but at the moment i think it is the most likely source of the issues.

pi0 avatar Jul 18 '23 09:07 pi0

@pi0

https://githubxuwmq6-kyyz--3000--c53ab388.local-credentialless.webcontainer.io/

Minimal demo to produce the error

  1. From home page try visiting /login directly the server doesn't responds , since you are still on home page , try click on "login" it will still not redirect.
  2. try npm generate, the crawler stops at pre-render itself

mrniamster avatar Jul 18 '23 13:07 mrniamster

Any update on this?

svekke avatar Dec 08 '23 19:12 svekke

Hello, is there any news on this? For me it is very wierd that a get call directly in the browser works, and then with useFetch inside a plugin, it returns this error. I've already try not using useFetch but only $fetch in the plugin (in case this composable didn't work here), but the error is the same

it seems something is blocking the http call or returning a bad response (503)

carbdias avatar Dec 27 '23 12:12 carbdias

I encountered the same problem, is there any solution? thanks ​

The server seems to be working normally in my case, but there is a problem with the display of devtool

Ena-Heleneto avatar Dec 28 '23 23:12 Ena-Heleneto

I've also had a probñem there. I had to redo the project from scratch with the devtools always on, to be sure it didn't crash anytime.

carbdias avatar Dec 29 '23 00:12 carbdias

I encountered the same problem, is there any solution? thanks​

The server seems to be working normally in my case, but there is a problem with the display of devtool

It should be added that this problem currently only occurs in the Windows development environment, and does not have this problem in the Linux server environment.

Ena-Heleneto avatar Dec 30 '23 17:12 Ena-Heleneto

Surprised there isn't bigger noise around this issue, I encounter this every day working on a smallish nuxt app

cmcnicholas avatar Feb 29 '24 20:02 cmcnicholas

same issue I am having

tbarus avatar Mar 25 '24 18:03 tbarus

Im facing this problem too using Nuxt, and as a workaround I could solve it using yarn dev --host and accessing the website using the network address.

The problem only occurs to me when using a specific public WIFI network with my company's computer which has firewall configurations. So I have my suspicions that this issue has something to do with security and permissions.

lucas-santosP avatar Apr 03 '24 02:04 lucas-santosP

I have here the same issue in this reproduction it is a most recently created project, with little code, but it is taking forever loading the page, and before it was giving 503 error, then I installed npm@latest globally, and not it is just taking forever and not leading. I just checked, 503 fetching loclahost. https://stackblitz.com/edit/github-4zdfkx?file=package.json

carbdias avatar May 30 '24 21:05 carbdias

for me this was solved with npm cache verify and opening the app in incognito mode. somehow nuxt framework is generating too much temp files or files in cache (I asume the idea was to improve performance) but it is blocking things. somehow older and larger applications I had didn't present this problem. just fresh started projects.

carbdias avatar May 30 '24 23:05 carbdias

I just wanted to add that we're still experiencing this a lot in our Nuxt 3 site which proxies a few routes to an old SPA (which is quite heavy with lots of requests). On Windows, some of the proxied requests will fail with an error 503. It's completely random as to which ones. I don't experience it while developing the same site on my Mac. It is definitely related to there being lots of concurrent requests though - it doesn't do it if there's only a few at once.

The workarounds listed above of trying via different network addresses don't seem to help. If we switch to an alternative proxy solution, such as nginx in a Docker container, that works fine. We'd prefer to use Nuxt as our proxy while developing though, as it's quicker and easier, with fewer dependencies.

dan-hammond avatar Aug 23 '24 13:08 dan-hammond

Is there any temporary way to address this issue?

kdydesign avatar Nov 01 '24 04:11 kdydesign

I recently upgraded vinxi to 0.50, I have this issue as well. From what I can tell, every request that comes from throw createError will result in a 503 error. The response in the browser is content type with text/html and the content is

        <header>
          <h2>503 Server Unavailable</h2>
        </header>
        <code><pre>Error: Not found 
    at createError (file:///C:/src/temp/yes/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:78:15)
    at eval (C:/src/temp/yes/packages/test/src/api/index.ts:80:52)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _callHandler (file:///C:/src/temp/yes/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1837:16)
    at async Object.handler (file:///C:/src/temp/yes/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1978:19)
    at async Server.toNodeHandle (file:///C:/src/temp/yes/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2270:7)
    </pre></code>

It doesn't matter what I put in createError() -- it all returns 503. My solution for now is to simply return an object, and not use createError.

kabforks avatar Dec 09 '24 13:12 kabforks