nuxt / cli

⚡️ Nuxt Generation CLI Experience.
https://github.com/nuxt/cli/discussions/3
MIT License
255 stars 59 forks source link

ERROR [unhandledRejection] connect ECONNREFUSED #338

Open ffixitt opened 7 months ago

ffixitt commented 7 months ago

Environment


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

ivryb commented 5 months ago

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

noook commented 5 months ago

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/@sentry+profiling-node@7.110.0/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)

cyruscollier commented 4 months ago

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
unitythemaker commented 3 months ago

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
albertolina commented 2 months ago

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

aaronguostudio commented 2 months ago

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

BotellaA commented 2 months ago

@danielroe is there a working workaround for this?

itoonx commented 2 months ago

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

saint-james-fr commented 4 days ago

Did you try this one ? worked for me

// nuxt.config.ts

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