Skip to content

fetch error when upgrading from node.js 16 to 18 #21609

@moebiusmania

Description

@moebiusmania

Environment

  • Operating System: Darwin
  • Node Version: v18.15.0
  • Nuxt Version: 3.5.3
  • Nitro Version: 2.4.1
  • Package Manager: npm@9.5.0
  • Builder: vite
  • User Config: modules, experimental
  • Runtime Modules: @nuxtjs/tailwindcss@6.7.2
  • Build Modules: -

Reproduction

  • clone this repo https://github.com/moebiusmania/atmmi-info-ui and install dependencies
  • run it with Node.js 16, you should see a populated page on localhost:3000 and no error on console
  • switch to Node.js 18 and re-run the dev server
  • on localhost:3000 you will see placeholder values and on console many 500 error coming from server side fetch

Describe the bug

Hello fellow devs, I have this small toy project built with Nuxt since early phases of v3 https://github.com/moebiusmania/atmmi-info-ui its a simple app that scrape data from a website using API routes and then some components consumes that same APIs and render the data on page.

I've used Node.js 16 since the beginning since there were some errors on Node.js 18, but trying again now I'm noticing this issue still lives. Since Node.js 16 will reach EOL within few months I would like to understand what's happening, I've browsed some similar issues and all of the proposed solution are not working.

Its really few lines of code that works perfectly on 16 and suddenly breaks on 18 with no apparent reason or explanation, by logging the fetch error I get something like this:

  statusCode: 500,
  fatal: false,
  unhandled: false,
  statusMessage: undefined,
  data: {
    url: '/api/traffic',
    statusCode: 500,
    statusMessage: '',
    message: 'fetch failed (https://www.atm.it/it/Pagine/default.aspx)',

which doesn't help much especially coming from the previous scenario where everything works.

Does anyone have a clear idea of what's breaking the fetch requests between the two environments?
thanks in advance

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions