artmizu / nuxt-prometheus

Prometheus metrics for NodeJS and a set of custom metrics for Nuxt applications
59 stars 11 forks source link

Invariant Violation: Failed to Patch the 'fetch' Module: Already Patched #43

Closed juusopiikkila closed 2 months ago

juusopiikkila commented 4 months ago

I encountered an Invariant Violation when attempting to patch the fetch module while using the this module. The error message indicates that the module has already been patched.

It seems like there's a conflict or a repeated attempt to patch the fetch module within the interceptors setup. This issue appeared after updating to the latest version of the nuxt-prometheus module.

Error Message

Invariant Violation
Failed to patch the 'fetch' module: already patched.
artmizu commented 4 months ago

@juusopiikkila Hi, thank you for the report

your issue and this problem have the same root, all problems are around the native fetch patching that ofetch does under the hood

right now I see only a few options:

  1. completely disable request time detection through module options (it needs to be implemented)
  2. just ignore this error, because it's actually a warning
  3. wait for news from ofetch about fetch patching
juusopiikkila commented 4 months ago

Ah, true. I guess I'll just stay in the older version and wait for news. Thanks!

artmizu commented 2 months ago

@juusopiikkila hi I just released the update, so by default request measurement time is disabled. It will resolve your issue https://github.com/artmizu/nuxt-prometheus/releases/tag/v2.4.0