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

ERROR [unhandledRejection] read ECONNRESET #23832

Open
sebastiandotdev opened this issue Oct 20, 2023 · 79 comments
Open

ERROR [unhandledRejection] read ECONNRESET #23832

sebastiandotdev opened this issue Oct 20, 2023 · 79 comments

Comments

@sebastiandotdev
Copy link

Environment

  • Operating System: Linux
  • Node Version: v18.18.2
  • Nuxt Version: 3.7.4
  • CLI Version: 3.9.0
  • Nitro Version: 2.6.3
  • Package Manager: [email protected]
  • Builder: -
  • User Config: app, devtools, modules, css, ui, colorMode, postcss
  • Runtime Modules: @nuxt/[email protected], @nuxt/[email protected]
  • Build Modules: -

Reproduction

Sorry, I can't share code due to corporate law... I hope you understand. 🙏

Describe the bug

When I am programming for a long time nuxt gives me that server error apparently and it is usually tedious because I have to start everything again

 Vite server hmr 17 files in 10811.276ms

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:41119  10:57:18 AM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

Additional context

No response

Logs

Vite server hmr 17 files in 10811.276ms

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:41119  10:57:18 AM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
@github-actions
Copy link
Contributor

Would you be able to provide a reproduction? 🙏

More info

Why do I need to provide a reproduction?

Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

What will happen?

If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

How can I create a reproduction?

We have a couple of templates for starting with a minimal reproduction:

👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

A public GitHub repository is also perfect. 👌

Please ensure that the reproduction is as minimal as possible. See more details in our guide.

You might also find these other articles interesting and/or helpful:

@danielroe
Copy link
Member

Do you have a custom HMR port? Is 41119 the port your main Nuxt dev server is running on?

@adam-code-labx
Copy link

I believe this one is extremely difficult to reproduce and perhaps an issue somewhere with the local env setup.
Also no custom HMR port defined this side.

This is one of the reasons I have not reported this myself. Even after completely reinstalling node pnpm this issue still occurs.

However @castrogarciajs perhaps this will help as a short term workaround

Nitro built in 6575 ms                                                                                                                                                                                                                        nitro 11:52:46 PMVite client warmed up in 14274ms                                                                                                                                                                                                                    11:52:47 PM
(node:80030) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)

 ERROR  [unhandledRejection] connect ETIMEDOUT 127.0.0.1:55605                                                                                                                                                                                         11:53:36 PM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

This port will of course change every time you restart the dev server.
My current workaround is to use http://127.0.0.1:55605/ which works then without any timeout issues

I think this perhaps relates to layers and directed at more complexed nuxt projects.
With a clean install without any 3rd party modules or plugins this doesn't happen.


Environment


@unitythemaker
Copy link

unitythemaker commented Oct 22, 2023

I'm experiencing the same issue. I'm using a package called node-rfc, which seems to be the root cause of the problem. I suspect the issue arises because this module has some C code bindings, and attempting hot reloading crashes the entire application. From my experience, the HTTP server doesn't crash but instead fully freezes. It becomes unresponsive to any requests, although it continues to listen on the port. I was planning to create a new issue when I find the time and can reproduce the problem in a minimal project, but I came across this and wanted to leave a comment.

@unitythemaker
Copy link

unitythemaker commented Oct 22, 2023

I forgot to mention the most important part: The code will work the first time I start the server, but it freezes whenever I make a change and save it. However, it only freezes when I make a change on the server-side, not on the client-side.

It is extremely annoying to Ctrl C and restart every time I make a change.

@unitythemaker
Copy link

unitythemaker commented Oct 22, 2023

I've successfully reproduced the problem in a minimal project. However, it's important to note that the node-rfc module relies on a licensed system library named nwrfcsdk, which includes a set of Linux .so library files. If you're interested, I can grant you access to the repository so that you can examine it and give it a try. Unfortunately, I'm unable to share this on StackBlitz or CodeSandbox due to their limitations. StackBlitz doesn't support file uploads, so I can't provide the nwrfcsdk. Additionally, I encountered various difficulties on CodeSandbox and couldn't proceed.

Please let me know your GitHub usernames so that I can invite you to the repository. I've already invited danielroe to the repository, which you can find here. If you have the time, we could arrange a screen-sharing session for further assistance.

I also attempted to address the issue by adding the following code snippet to nuxt.config.ts, but it didn't resolve the problem:

vite: {
  optimizeDeps: {
    exclude: ['node-rfc'],
  },
}

One more challenge I encountered is that when I run npm run build and attempt to start it with node .output/server/index.mjs, an error related to node-rfc occurs. This issue is resolved when I manually copy the node_modules/node-rfc to .output/server/node_modules/node-rfc/.

@sebastiandotdev
Copy link
Author

sebastiandotdev commented Oct 24, 2023

@danielroe

Hello,

It is impossible to make a reproduction, because it is an error that happens during development and I cannot capture the exact moment of the error. I just have to close everything again.

I don't have a custom port, I work with the default nuxt configuration.

@productdevbook
Copy link
Sponsor Member

I think this happens in projects with db connection, I get the same error sometimes.

Does everyone have a db connection in the project?

@adam-code-labx
Copy link

@productdevbook I don't think this issue is related to the db connection.
In our headless e-commerce stack we are using nitro connecting through to Laravel

Most of our endpoints use useAsyncData catchall to hit nuxt server routes.
Then we use $fetch to send server-side for example using our custom composable.

This was working up until v3.7.0 so I suspect it has something to do with the Nitro 2.6 update.

import type { H3Event } from 'h3'
import { getCookie } from 'h3'

const baseUrl = process.env.NUXT_APP_HUB_BASE_URL
interface INitroApiOptions {
  event: H3Event
  endpoint: string
  action?: string
  requiresAuth?: boolean
  method?: any
  contentType?: string
  query?: any
}

export default function useNitroApi(options: INitroApiOptions, data?: any): Promise<any> {
  const {
    event,
    endpoint,
    action,
    requiresAuth = false,
    method = 'GET',
    contentType = 'application/json',
    query = {},
  } = options
  const headers: any = {
    Accept: contentType,
    'Language-Locale': getCookie(event, 'i18n_redirected'),
    'Content-Type': contentType,
  }
  if (requiresAuth) {
    headers.Authorization = `Bearer ${getCookie(event, 'token') || ''}`
  }

  const opts: any = {
    method,
    headers,
  }

  if (!['show', 'index', 'destroy'].includes(<string>action)) {
    opts.body = data ? JSON.stringify(data) : undefined
    opts.query = query
  }

  return $fetch(`${baseUrl}${endpoint}`, opts)
}

@productdevbook
Copy link
Sponsor Member

This was working up until v3.7.0 so I suspect it has something to do with the Nitro 2.6 update.

I also had this error in version 3.7 and I was not interested because I was suspicious of the db. now 3.8 has the same error.

@adam-code-labx
Copy link

@danielroe Could the issue be due to nitro changing to unjs/httpxy?

This does seem to be around the same date 3.7.0 was released.
unjs/nitro@dd8101f

Also this does seem to be where the error is coming from 👀
https://github.com/unjs/httpxy/blob/1f62fffb141e905a398f55eb34bd75366082ca3c/src/middleware/web-incoming.ts#L122

@adam-code-labx
Copy link

This was the issue and I have found a solution which works perfectly 😁
Try adding this to your nuxt config. On my side there are no more timeouts even after several refreshes!

nitro: {
  devProxy: {
    host: 'localhost',
  },
},

@unitythemaker
Copy link

This was the issue and I have found a solution which works perfectly 😁 Try adding this to your nuxt config. On my side there are no more timeouts even after several refreshes!

nitro: {
  devProxy: {
    host: 'localhost',
  },
},

It doesn't work for me (I get problem every time I update the server-side code, 100% reproducible) :/

image

@adam-code-labx
Copy link

@unitythemaker Are you using localhost with a default port?
Your error seems to be related more towards node and perhaps node-rfc
What is your current node version?

@productdevbook @castrogarciajs did my solution work for you guys?

@sebastiandotdev
Copy link
Author

@adam-code-labx My version is 20.9.0, I use default port of nuxt

@adam-code-labx
Copy link

@adam-code-labx My version is 20.9.0, I use default port of nuxt

Ok and you still get an error after adding this to your nuxt config?

nitro: {
  devProxy: {
    host: 'localhost',
  },
},

@unitythemaker
Copy link

@unitythemaker Are you using localhost with a default port? Your error seems to be related more towards node and perhaps node-rfc What is your current node version?

@productdevbook @castrogarciajs did my solution work for you guys?

Yeah probably it is because node-rfc and some complicated thing happening with hmr and it breaks from it. However, I am not sure because this is just a guess.
I normally use custom host and port but error occurs even if I use the default host and port (localhost:3000 for me). I tried with both.

unitythemaker@blazingfast ~/Projects/Other/sap_pentest/sap_pentest/frontend (main) 
❯ node -v
v18.17.0
unitythemaker@blazingfast ~/Projects/Other/sap_pentest/sap_pentest/frontend (main) 
❯ cat package.json | grep nuxt
  "name": "nuxt-app",
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
    "@nuxt/devtools": "latest",
    "@nuxtjs/eslint-module": "^4.1.0",
    "@nuxtjs/i18n": "8.0.0-rc.4",
    "@nuxtjs/sentry": "^7.5.0",
    "@nuxtjs/tailwindcss": "^6.8.0",
    "@pinia/nuxt": "^0.4.11",
    "nuxt": "^3.8.0",

@unitythemaker
Copy link

unitythemaker commented Oct 26, 2023

If you ever wanted to check out my minimal reproduction, I gave you access at here.

@sebastiandotdev
Copy link
Author

If you ever wanted to check out my minimal reproduction, I gave you access at here.

I recommend you update node js to version 20
@adam-code-labx's recommendation is working for me, maybe that's it

@unitythemaker
Copy link

If you ever wanted to check out my minimal reproduction, I gave you access at here.

I recommend you update node js to version 20 @adam-code-labx's recommendation is working for me, maybe that's it

I switched to Node v20 now. It is still the same.

@productdevbook
Copy link
Sponsor Member

image

@adam-code-labx
Copy link

@productdevbook ummm thats strange overriding nitro devProxy should have worked for you 🤔
Can you share your nuxt config. Not sure it will make any difference but you can try directly with 127.0.0.1 instead of localhost. Also add it at the end of your config.

export default defineNuxtConfig({
  // ... nuxt config
  nitro: {
    devProxy: {
      host: '127.0.0.1',
    },
  },
})

@mileetos
Copy link

@productdevbook ummm thats strange overriding nitro devProxy should have worked for you 🤔 Can you share your nuxt config. Not sure it will make any difference but you can try directly with 127.0.0.1 instead of localhost. Also add it at the end of your config.

export default defineNuxtConfig({
  // ... nuxt config
  nitro: {
    devProxy: {
      host: '127.0.0.1',
    },
  },
})

This seems to have solved it for me. Thank you very much!

@uovol
Copy link

uovol commented Jan 14, 2024

I have the same problem

 ERROR  [unhandledRejection] connect ETIMEDOUT 127.0.0.1:55231

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)

This does not solve my problem

nitro: {
    devProxy: {
      host: '127.0.0.1',
    },
  },

@lx-elephantxiang
Copy link

same,I get problem every time when i refresh browser, 100% reproducible
企业微信截图_17134072509976

@Hibrix-net
Copy link

same,I get problem every time when i refresh browser, 100% reproducible 企业微信截图_17134072509976

Yes, HMR never works for me due to this error. I always refresh manually during development.

@bitsnaps
Copy link

@danielroe Sorry for the ping, I'm not sure if the following issue is related to that one, but I'm getting ERROR [nitro] [unhandledRejection] XXX is not defined where XXX is a global js library (old article here...), and here are the reproducible steps:
1- Create a new Nuxt (v3.11.2) app
2- Register a global js (e.g. Stripe API):
File: nuxt.config.ts:

...
  app: {
    head: {
      charset: 'utf-8',
      viewport: 'width=device-width, initial-scale=1',
      script: [
        { 
            'hid':'stripe',
            'src':'https://js.stripe.com/v3/',
            'defer': true
        }
    ]
    },
  },

3- Interact with the API from a page:
File: app.vue:

<script setup>
let isStripe = () => {
  if (Stripe) {
    return new Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
  }
  return false;
};
</script>
<template>
  <div>
    <h1 v-if="isStripe()">ok</h1>
    <h2 v-else>No</h2>
  </div>
</template>

P.S. The app will continue to work while the lib is loading, but looks like Nitro is detecting an error.
Let me know if I had to open a new issue for that case.

@danielroe
Copy link
Member

@bitsnaps That's not valid code on the server. Wrap it in if (import.meta.client) or check with typeof Stripe or access globalThis.Stripe.

@bitsnaps
Copy link

bitsnaps commented Apr 18, 2024

Thanks! I thought ClientOnly was the proper way to check for that, but that's for the client side only, we need some time to get used to write Nuxt on the server! I've just came across your note here to grasp that point.

@BotellaA
Copy link

@danielroe could we just have an update, will you or anyone from the core team look at this anytime soon or should the community find a workaround on their own?
Thanks for your answer.

@abarke
Copy link
Sponsor

abarke commented May 4, 2024

I'm still having issues with this after upgrading. Really frustrating. First npx nuxi@latest upgrade did not want to upgrade from [email protected] to [email protected] so I manually upgraded using pnpm up nuxt --latest and now this issue 😓

Electron
image

CLI
image

pnpm nuxi info

------------------------------
- Operating System: Windows_NT
- Node Version:     v18.15.0
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  [email protected]
- Builder:          -
- User Config:      ssr, css, modules, ionic, vite, nitro
- Runtime Modules:  @nuxtjs/[email protected], [email protected]
- Build Modules:    -
------------------------------

@marcotw
Copy link

marcotw commented May 6, 2024

Same error:

  • Operating System: Windows_NT
  • Node Version: v18.18.2
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: [email protected]
  • Builder: -
  • User Config: ssr, electron, content, components, imports, css, app, build, modules, vite, nitro, devtools
  • Runtime Modules: (), [email protected], @nuxt/[email protected], @pinia/[email protected]
  • Build Modules: -

@TechAkayy
Copy link

When researching about it, there seem to be a lot of somewhat related issues:
#24355
#25115
#26396
nuxt/image#1158
nuxt/cli#335
nuxt/cli#338
nuxt/cli#346
caoxiemeihao/nuxt-electron#71
nuxt/cli#231
nuxt/cli#232
nuxt/cli#425

I think most of these issues are related to nuxi -> nuxt cli transition that happened with 3.7.

I have been having good luck staying back with 3.7.3 (not sure if I could go update further by staying on nuxi 3.8.4) by means of the below overrides in my package.json:

  "pnpm": {
    "overrides": {
      "nuxi": "3.8.4"
    }
  },
  "overrides": {
    "nuxi": "3.8.4"
  },

While this is not really the solution to this issue, given the wait, if you could, give it a shot. Obviously, this is a trade-off as this will miss other bug fixes that came in the later releases.

@unitythemaker
Copy link

Please note, the following are my observations, thoughts, and speculations.

From my observations, there are two distinct problems at play here, neither of which are directly related to Nuxt itself, but rather to NitroPack or the compiler used for Nitro. I was unable to reproduce these issues by merely updating client-side code. However, the behaviors of Nitro and Nuxt seem to diverge significantly when these bugs occur. In Nitro, the server continues to serve requests as usual but stops reloading, running the pre-bug code. In Nuxt, requests stop receiving responses, and a listener keeps the client alive indefinitely, preventing even the Nuxt starting page from loading.

Problem 1: Race Condition

The race condition issue appears more frequently in larger projects due to the time it takes to build the Nitro server. In a medium-scale project, if you press Ctrl S on a server-side code multiple times in quick succession (4-5 times within a second), it crashes.

To reproduce this, I created a directory named libraries/ at the project root, added a foo.ts file exporting a function that returns "foo", and created an API endpoint that calls this function. As the library is not auto-imported, I manually imported foo from ~/libraries/foo. I'm unsure if this issue affects auto-imported modules or if it relates to modules at all, but I was able to reproduce it consistently by holding down Ctrl S.


Problem 2: Incompatible Modules

The second issue occurs when using incompatible modules, such as sharp, which relies on C libraries or other non-JS files requiring .so files or additional dependencies. The compiler does not account for these, causing hot module reloading to fail when these libraries are imported.


Additional Observations

There seems to be some server-client interaction between the compiler and the running program to perform HMR or a similar process, though this area is less clear to me. The build server likely encounters a fatal error and crashes, leading to the client receiving a read ECONNRESET error due to the forced disconnection. It then retries the connection and fails with connect ETIMEDOUT 127.0.0.1:<ephemeral port>. For security, the server runs on localhost and uses a randomly selected ephemeral port, probably to allow multiple Nuxt dev servers to run on the same machine.


Collaboration Request

If others could confirm or reject these observations, we can work together to pinpoint the exact issues and potentially develop a solution. Your feedback and insights are crucial for us to tackle this problem collaboratively and effectively. Let's pool our knowledge and efforts to fix this issue.

Why this is important for me? This issue is becoming increasingly critical for me as our projects grow. Particularly because we use Nuxt UI, which renders pages very slowly for some reason. Adding this crashing problem to the mix makes it nearly unbearable to continue developing our projects beyond a certain point. I literally need to wait around 30 seconds between each server-side change, which significantly hampers our development process.

Thank you for your understanding and cooperation.

@TechAkayy
Copy link

TechAkayy commented Jun 6, 2024

I have been maintaining few reliable reproductions for this [unhandledRejection] type errors in the nuxt/cli repo from 3.7.4 onwards.

Please refer to these:
nuxt/cli#231
nuxt/cli#232
nuxt/cli#425

Lately in nuxt/cli#425, I have noticed HMR not establishing a connection at all when a vite plugin is added using the addVitePlugin nuxt kit utility.

As I previously mentioned, all these unhandledRejection E-type errors all surfaced only after the nuxi->nuxt/cli transition. This should have ideally been released in an experimental way,so the community could have test and avoided all these issues instead of pushing it on us. Given the random nature of these errors, even ecosystem ci wouldn't have picked these up. It would be great to have these errors sorted before going another major version.

Copy link
Member

Thank you @TechAkayy. @pi0 and I have discussed reverting the current behaviour in nuxi.

@oripka
Copy link

oripka commented Jul 17, 2024

I ran into this problem with a mono-repository that I just refactored in multiple layers and it only happens when I change code in the server/ folder (middleware or api) and save it.

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:63003                                                                                      5:14:57 PM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)

It makes developing a nightmare as one has to restart nuxi dev everytime one changes the api.

Is there a way to debug this?

@prostohttp
Copy link

prostohttp commented Jul 17, 2024

I ran into this problem with a mono-repository that I just refactored in multiple layers and it only happens when I change code in the server/ folder (middleware or api) and save it.

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:63003                                                                                      5:14:57 PM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)

It makes developing a nightmare as one has to restart nuxi dev everytime one changes the api.

Is there a way to debug this?


npx nuxi@latest upgrade
every time after updating some dependencies

@0xtlt
Copy link

0xtlt commented Jul 18, 2024

Still getting the problem even with npx nuxi@latest upgrade.

Each time I save a /server/api/*.ts file:

Nuxi version: 3.12.0
Nuxt version: 3.12.3

logs

ERROR  [unhandledRejection] socket hang up                                                                                  11:49:45 AM

  at Socket.socketOnEnd (node:_http_client:526:23)
  at Socket.emit (node:events:532:35)
  at endReadableNT (node:internal/streams/readable:1696:12)
  at process.processTicksAndRejections (node:internal/process/task_queues:82:21)


 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:57197                                                            11:50:11 AM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16)

@0xtlt
Copy link

0xtlt commented Jul 18, 2024

Hi again, I fixed it with disabling all prerender:

export default defineNuxtConfig({
	...
	routeRules: {
		"/": { prerender: false },
		"/api/search.json": { prerender: false },
		"/docs": { redirect: "/docs/getting-started", prerender: false },
	},
	...
});

@Flashantik
Copy link

I ran into this problem with a mono-repository that I just refactored in multiple layers and it only happens when I change code in the server/ folder (middleware or api) and save it.

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:63003                                                                                      5:14:57 PM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)

It makes developing a nightmare as one has to restart nuxi dev everytime one changes the api.

Is there a way to debug this?

nuxt/cli#335 (comment)

now i found only 2 solutions.

  1. use [email protected] - last version without bug
  2. use bun instead node

Well, we are still waiting for the next version. I really hope that this will be fixed in nuxt@4

@oripka
Copy link

oripka commented Jul 22, 2024

I ran into this problem with a mono-repository that I just refactored in multiple layers and it only happens when I change code in the server/ folder (middleware or api) and save it.

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:63003                                                                                      5:14:57 PM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)

It makes developing a nightmare as one has to restart nuxi dev everytime one changes the api.
Is there a way to debug this?

nuxt/cli#335 (comment)

now i found only 2 solutions.

  1. use [email protected] - last version without bug
  2. use bun instead node

Well, we are still waiting for the next version. I really hope that this will be fixed in nuxt@4

For me the issue was fixed with nuxt/content#2691

@shai-raz
Copy link

I ran into this problem with a mono-repository that I just refactored in multiple layers and it only happens when I change code in the server/ folder (middleware or api) and save it.

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:63003                                                                                      5:14:57 PM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16)

It makes developing a nightmare as one has to restart nuxi dev everytime one changes the api.
Is there a way to debug this?

nuxt/cli#335 (comment)

now i found only 2 solutions.

  1. use [email protected] - last version without bug
  2. use bun instead node

Well, we are still waiting for the next version. I really hope that this will be fixed in nuxt@4

how would you use bun instead of node

@dalisys
Copy link

dalisys commented Aug 16, 2024

@shai-raz , install it and then run bun --bun run dev
PS: If you plan to use @supabase/nuxt, be aware that bun has a bug with it and doesn't work (link)

Somehow, I don't have the problem on AMD CPU laptops; it only occurs on Intel ones.

@shai-raz
Copy link

@shai-raz , install it and then run bun --bun run dev PS: If you plan to use @supabase/nuxt, be aware that bun has a bug with it and doesn't work (link)

Somehow, I don't have the problem on AMD CPU laptops; it only occurs on Intel ones.

Thanks, that actually makes it work, which is amazing:))
But now there's another issue that nuxt devtools won't work :<

@robinscholz
Copy link

We are also facing this issue in a monorepo with a payload cms backend, a nuxt frontend and a nuxt module for components. Nothing overly complicated, but half the time the frontend simply won’t work.

None of the workarounds posted here seem to have any impact.

We are getting all sorts of errors, at random times. Sometimes after navigating, sometimes after a hard refresh. It’s basically impossible to work on the project at all in this state.

image image

I’d be happy to give the Nuxt team access to our repo and help set up a local environment to reproduce the problems we are facing. @danielroe @pi0 please let me know if this would be of interest!

@robinscholz
Copy link

One source of the problems we are facing is an icon component that pulls in a large icon library with import.meta.glob. I'm guessing nuxt is not able to handle this amount of async components while in dev mode.

<template>
  <icon-component class="icon-renderer" />
</template>

<script lang="ts" setup>
import { defineAsyncComponent, type ComponentPublicInstance } from 'vue'
import { filename } from 'pathe/utils'

interface IconRenderer {
  name: string
  weight?: 400 | 500
}

const props = withDefaults(defineProps<IconRenderer>(), {
  weight: 400,
})

const IconComponent = defineAsyncComponent({
  loader: async () => {
    const glob = import.meta.glob<{ default: ComponentPublicInstance }>(
      `../assets/icons/*-(400|500).svg`,
      {
        eager: true,
      }
    )

    const icons = Object.fromEntries(
      Object.entries(glob).map(([key, value]) => [filename(key), value.default])
    )

    const name = `${props.name}-${props.weight}`
    const icon = icons[name]

    return icon
  },
})
</script>

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