cli icon indicating copy to clipboard operation
cli copied to clipboard

ERROR [unhandledRejection] connect ECONNREFUSED

Open ffixitt opened this issue 1 year ago • 19 comments

Environment


  • Operating System: Darwin
  • Node Version: v20.10.0
  • Nuxt Version: 3.10.1
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, runtimeConfig
  • Runtime Modules: -
  • Build Modules: -

Reproduction

I tried to reproduce the problem but it does not appear as often as on the local machine. But every time it appears when creating a .env file and occasionally when editing it.

Demo

Describe the bug

Every time when I save a .env file I get an error, both on Mac and Windows.

For ex. trying to edit vars NUXT_PUBLIC_API_BASE & NUXT_API_SECRET

From MacOS:

ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:54689                                                                                          
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
From Windows

ERROR  [unhandledRejection] kill ENOSYS 

  at ChildProcess.kill (node:internal/child_process:509:13)
  at kill (/C:/Users/user/Documents/Code/website/node_modules/nuxi/dist/chunks/dev.mjs:247:17)
  at restart (/C:/Users/user/Documents/Code/website/node_modules/nuxi/dist/chunks/dev.mjs:252:5)
  at ChildProcess.<anonymous> (/C:/Users/user/Documents/Code/website/node_modules/nuxi/dist/chunks/dev.mjs:281:9)
  at ChildProcess.emit (node:events:518:28)
  at emit (node:internal/child_process:951:14)
  at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Additional context

No response

Logs

No response

ffixitt avatar Feb 13 '24 13:02 ffixitt

I'm always getting this same error even without editing .env file Just after ~60-90 minutes of work in dev mode, I need to restart it

ivryb avatar Apr 20 '24 10:04 ivryb

Just noticed an additional stacktrace next to this error:

#
# Fatal error in , line 0
# unreachable code
#
#
#
#FailureMessage Object: 0x17432a2b8
----- Native stack trace -----

 1: 0x100999260 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 2: 0x101a1a9ac V8_Fatal(char const*, ...) [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 3: 0x100ff6610 v8::internal::InstructionStreamMap::~InstructionStreamMap() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 4: 0x100fdf4c4 v8::internal::CpuProfiler::~CpuProfiler() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 5: 0x100ae8fcc v8::CpuProfiler::Dispose() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 6: 0x10651eecc FreeAddonData(napi_env__*, void*, void*) [/Users/nook/work/access42/audit/node_modules/.pnpm/@[email protected]/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-darwin-arm64-115.node]
 7: 0x10090574c void node_napi_env__::CallbackIntoModule<true, void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)>(void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&&) [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 8: 0x1009016a4 node_napi_env__::CallFinalizer(void (*)(napi_env__*, void*, void*), void*, void*) [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
 9: 0x1008e9444 non-virtual thunk to v8impl::RefBase::Finalize() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
10: 0x100901490 node_napi_env__::DeleteMe() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
11: 0x100890428 node::CleanupQueue::Drain() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
12: 0x1008db00c node::Environment::RunCleanup() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
13: 0x1008691d0 node::FreeEnvironment(node::Environment*) [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
14: 0x1009ea780 node::worker::Worker::Run() [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
15: 0x1009eda18 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/nook/.nvm/versions/node/v20.11.0/bin/node]
16: 0x183b8f034 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
17: 0x183b89e3c thread_start [/usr/lib/system/libsystem_pthread.dylib]

[7:32:07 PM]  ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:60088

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

(seems related to Sentry in this exact use case, but it is disabled in local development. I can also confirm I often see the ECONNREFUSED though)

noook avatar Apr 20 '24 17:04 noook

We started getting this error when we starting running Nuxt locally with an SSL cert. Possible it's a memory management issue, as we often see various memory-related errors like like right before the ECONNREFUSED:

node(55580,0x10a0e0580) malloc: *** error for object 0x6000002a7aa8: pointer being freed was not allocated
node(55580,0x10a0e0580) malloc: *** set a breakpoint in malloc_error_break to debug

cyruscollier avatar May 18 '24 15:05 cyruscollier

I've used to getting these errors, I need to restart my dev server every 15 minutes and today I got this one too in my console if that helps:

malloc(): invalid size (unsorted)

Edit: After posting this comment I also got errors below.

free(): invalid next size (fast)
free(): invalid pointer

unitythemaker avatar May 29 '24 12:05 unitythemaker

I am experiencing the same issue, any fix for this?

albertolina avatar Jul 11 '24 22:07 albertolina

I got the same issue after upgrading to "nuxt": "^3.12.3"

aaronguostudio avatar Jul 12 '24 03:07 aaronguostudio

@danielroe is there a working workaround for this?

BotellaA avatar Jul 18 '24 14:07 BotellaA

i got the same error on node v22.0.0, macos

itoonx avatar Jul 20 '24 06:07 itoonx

Did you try this one ? worked for me

// nuxt.config.ts

routeRules: {
  "/api/*": {
    prerender: false,
  }
}

saint-james-fr avatar Sep 16 '24 11:09 saint-james-fr

Same issue here :(

felixranesberger avatar Sep 28 '24 08:09 felixranesberger

same here, really horrible to have to restart the server every 2 minutes, no way to know why

if that can help :


: 0x1023cf618 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x10347f968 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x10266949c v8::internal::GlobalHandles::NodeSpace<v8::internal::GlobalHandles::Node>::Release(v8::internal::GlobalHandles::Node*) [/usr/local/bin/node]
 4: 0x102a392fc v8::internal::WeakCodeRegistry::Clear() [/usr/local/bin/node]
 5: 0x102a195c4 v8::internal::CpuProfiler::DisableLogging() [/usr/local/bin/node]
 6: 0x102a19414 v8::internal::CpuProfiler::~CpuProfiler() [/usr/local/bin/node]
 7: 0x102522cf4 v8::CpuProfiler::Dispose() [/usr/local/bin/node]
 8: 0x107db45a0 FreeAddonData(napi_env__*, void*, void*) [/Users/**/Documents/programming/pro/pro-dashboard/node_modules/.pnpm/@[email protected]/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-darwin-arm64-115.node]
 9: 0x10233a824 void napi_env__::CallIntoModule<void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&, void node_napi_env__::CallbackIntoModule<true, void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)>(void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&&)::'lambda'(napi_env__*, v8::Local<v8::Value>)>(void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&, void node_napi_env__::CallFinalizer<true>(void (*)(napi_env__*, void*, void*), void*, void*)::'lambda'(napi_env__*)&&) [/usr/local/bin/node]
10: 0x102336848 node_napi_env__::CallFinalizer(void (*)(napi_env__*, void*, void*), void*, void*) [/usr/local/bin/node]
11: 0x10231d520 non-virtual thunk to v8impl::RefBase::Finalize() [/usr/local/bin/node]
12: 0x102336630 node_napi_env__::DeleteMe() [/usr/local/bin/node]
13: 0x1022c3ba8 node::CleanupQueue::Drain() [/usr/local/bin/node]
14: 0x10230ef1c node::Environment::RunCleanup() [/usr/local/bin/node]
15: 0x10229d188 node::FreeEnvironment(node::Environment*) [/usr/local/bin/node]
16: 0x1024229fc node::worker::Worker::Run() [/usr/local/bin/node]
17: 0x102425bd4 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/usr/local/bin/node]
18: 0x1a0319f94 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
19: 0x1a0314d34 thread_start [/usr/lib/system/libsystem_pthread.dylib]

BYohann avatar Sep 28 '24 15:09 BYohann

Downgrading Nuxt fixed the issue for me

felixranesberger avatar Sep 28 '24 16:09 felixranesberger

Downgrading Nuxt fixed the issue for me

From what version to what version?

nandi95 avatar Oct 02 '24 16:10 nandi95

Downgrading Nuxt fixed the issue for me

From what version to what version?

I'm running on [email protected]

felixranesberger avatar Oct 04 '24 18:10 felixranesberger