Giter VIP home page Giter VIP logo

Comments (13)

ronag avatar ronag commented on June 23, 2024

@KhafraDev Seems valid.

from undici.

mcollina avatar mcollina commented on June 23, 2024

@stefan-garofalo can you try to isolate what combination of response body + headers is causing this? In order to fix we need a server that reproduces the problem, otherwise it's impossible to find out.

Nothing really stands up by looking at the diffs.

from undici.

stefan-garofalo avatar stefan-garofalo commented on June 23, 2024

@stefan-garofalo can you try to isolate what combination of response body + headers is causing this? In order to fix we need a server that reproduces the problem, otherwise it's impossible to find out.

Nothing really stands up by looking at the diffs.

I managed to specifically install the latest node 22 version (22.3.0) locally and now I am actually reproducing the error outside of github workers too.

This is the response:

Response {
  status: 200,
  statusText: '',
  headers: Headers {
    'access-control-allow-headers': 'Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type',
    'access-control-expose-headers': 'X-WP-Total, X-WP-TotalPages, Link',
    allow: 'GET',
    'content-type': 'application/json; charset=UTF-8',
    date: 'Fri, 14 Jun 2024 09:30:02 GMT',
    link: '<MY_CMS_URL>; rel="https://api.w.org/"',
    server: 'Apache/2.4.59 (Debian)',
    vary: 'Origin',
    'x-content-type-options': 'nosniff',
    'x-powered-by': 'PHP/8.2.19',
    'x-robots-tag': 'noindex',
    'x-wp-total': '1',
    'x-wp-totalpages': '1',
    'transfer-encoding': 'chunked'
  },
  body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
  bodyUsed: false,
  ok: true,
  redirected: false,
  type: 'default',
  url: 'MY_CMS_URL'
}

And here follows the body

[
  {
    "id": 13,
    "date": "2024-05-29T11:49:34",
    "date_gmt": "2024-05-29T09:49:34",
    "guid": {
      "rendered": "MY_CMS_URL"
    },
    "modified": "2024-06-13T17:35:54",
    "modified_gmt": "2024-06-13T15:35:54",
    "slug": "homepage",
    "status": "publish",
    "type": "page",
    "link": "MY_CMS_URL",
    "title": {
      "rendered": "Homepage"
    },
    "content": {
      "rendered": "",
      "protected": false
    },
    "excerpt": {
      "rendered": "",
      "protected": false
    },
    "author": 1,
    "featured_media": 0,
    "parent": 0,
    "menu_order": 4,
    "comment_status": "closed",
    "ping_status": "closed",
    "template": "",
    "meta": {
      "footnotes": ""
    },
    "acf": {
      "hero": {
        "titolo": "LOREM IPSUM DOLOR SIT AMET, CONSETETUR SADIPSCING ELITR SED DIAM",
        "paragrafo": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr.",
        "cta": {
          "etichetta": "lorem",
          "link": "/"
        }
      },
      "pagine": {
        "lista": [49, 67]
      },
      "storie": {
        "titolo": "Lorem",
        "lista": [
          {
            "titolo": "Lorem ipsum dolor sit amet consetetur",
            "cover": {
              "ID": 44,
              "id": 44,
              "status": "inherit",
              "uploaded_to": 13,
              "date": "2024-05-30 15:24:42",
              "modified": "2024-05-30 15:24:48",
              "menu_order": 0,
              "mime_type": "image/png",
              "type": "image",
              "subtype": "png",

              "width": 1830,
              "height": 1866,
              "sizes": {
                "thumbnail-width": 150,
                "thumbnail-height": 150,
                "medium-width": 294,
                "medium-height": 300,
                "medium_large-width": 768,
                "medium_large-height": 783,
                "large-width": 1004,
                "large-height": 1024,
                "1536x1536-width": 1506,
                "1536x1536-height": 1536,
                "2048x2048-width": 1830,
                "2048x2048-height": 1866
              }
            },
            "colore": "light"
          },
          {
            "titolo": "Lorem ipsum dolor sit amet consetetur",
            "cover": {
              "ID": 44,
              "id": 44,
              "filesize": 89931,
              "author": "1",
              "uploaded_to": 13,
              "date": "2024-05-30 15:24:42",
              "modified": "2024-05-30 15:24:48",
              "menu_order": 0,
              "mime_type": "image/png",
              "type": "image",
              "subtype": "png",
              "width": 1830,
              "height": 1866,
              "sizes": {
                "thumbnail-width": 150,
                "thumbnail-height": 150,
                "medium-width": 294,
                "medium-height": 300,
                "medium_large-width": 768,
                "medium_large-height": 783,
                "large-width": 1004,
                "large-height": 1024,
                "1536x1536-width": 1506,
                "1536x1536-height": 1536,
                "2048x2048-width": 1830,
                "2048x2048-height": 1866
              }
            },
            "colore": "white"
          },
          {
            "titolo": "Lorem ipsum dolor sit amet consetetur",
            "cover": {
              "ID": 44,
              "id": 44,
              "filesize": 89931,
              "author": "1",
              "status": "inherit",
              "uploaded_to": 13,
              "date": "2024-05-30 15:24:42",
              "modified": "2024-05-30 15:24:48",
              "menu_order": 0,
              "mime_type": "image/png",
              "type": "image",
              "subtype": "png",
              "width": 1830,
              "height": 1866,
              "sizes": {
                "thumbnail-width": 150,
                "thumbnail-height": 150,
                "medium-width": 294,
                "medium-height": 300,
                "medium_large-width": 768,
                "medium_large-height": 783,
                "large-width": 1004,
                "large-height": 1024,
                "1536x1536-width": 1506,
                "1536x1536-height": 1536,
                "2048x2048-width": 1830,
                "2048x2048-height": 1866
              }
            },
            "colore": "secondary"
          },
          {
            "titolo": "Lorem ipsum dolor sit amet consetetur",
            "cover": {
              "ID": 44,
              "id": 44,
              "filesize": 89931,
              "author": "1",
              "status": "inherit",
              "uploaded_to": 13,
              "date": "2024-05-30 15:24:42",
              "modified": "2024-05-30 15:24:48",
              "menu_order": 0,
              "mime_type": "image/png",
              "type": "image",
              "subtype": "png",
              "width": 1830,
              "height": 1866,
              "sizes": {
                "thumbnail-width": 150,
                "thumbnail-height": 150,
                "medium-width": 294,
                "medium-height": 300,
                "medium_large": "MY_CMS_URL/wp-content/uploads/2024/05/logobuzzi-768x783.png",
                "medium_large-width": 768,
                "medium_large-height": 783,
                "large-width": 1004,
                "large-height": 1024,
                "1536x1536-width": 1506,
                "1536x1536-height": 1536,
                "2048x2048-width": 1830,
                "2048x2048-height": 1866
              }
            },
            "colore": "light"
          }
        ]
      },
      "buca": {
        "titolo": "LOREM IPSUM DOLOR SIT AMET",
        "paragrafo": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum."
      },
      "seo": {
        "title": "Homepage",
        "description": "Lorem ipsum dolor homepage",
        "image": false
      }
    },
    "_links": {
      "self": [
        {
          "href": "MY_CMS_URL"
        }
      ],
      "collection": [
        {
          "href": "MY_CMS_URL"
        }
      ],
      "about": [
        {
          "href": "MY_CMS_URL"
        }
      ],
      "author": [
        {
          "embeddable": true,
          "href": "MY_CMS_URL"
        }
      ],
      "replies": [
        {
          "embeddable": true,
          "href": "MY_CMS_URL"
        }
      ],
      "version-history": [
        {
          "count": 9,
          "href": "MY_CMS_URL"
        }
      ],
      "predecessor-version": [
        {
          "id": 204,
          "href": "MY_CMS_URL"
        }
      ],
      "wp:attachment": [
        {
          "href": "MY_CMS_URL"
        }
      ],
      "curies": [
        {
          "name": "wp",
          "href": "https://api.w.org/{rel}",
          "templated": true
        }
      ]
    }
  }
]

awaiting response.text() does not trigger any error, only json parsing. Parsing the response.text() using any online parser still works indeed

from undici.

mcollina avatar mcollina commented on June 23, 2024

@stefan-garofalo can you include a complete example on reproducing it outside of GitHub Actions? Ideally client+server.

from undici.

stefan-garofalo avatar stefan-garofalo commented on June 23, 2024

@mcollina I tried to reproduce it. When asked to provide headers and body as you requested I did nvm use 22.3.0 and could reproduce it on my project on my machine. I updated the issue's description accordingly

from undici.

stefan-garofalo avatar stefan-garofalo commented on June 23, 2024

But I also failed to reproduce the issue outside of my current nextjs project. I tried node only with npm init, I tried a new empty Nextjs app, but still not reproducible

from undici.

mcollina avatar mcollina commented on June 23, 2024

Keep going at it, without the reproduction will be impossible to fix :(.

  1. Is the new project talking to the same API of the old one?
  2. Are the versions of Next.js the same?
  3. Inside the "faulty" app, can you try installing undici directly and calling require('undici').fetch()?

from undici.

stefan-garofalo avatar stefan-garofalo commented on June 23, 2024
  1. In the new project I tried calling both the API used in the faulty example and the public pokemon API
  2. Nextjs versions are the same
  3. I tried calling undici.fetch() directly and it now works in the faulty scenario.

So I guess its not really about undici. Maybe some conflicts between fetch ad Nextjs patches? Should I reopen this issue in Nextjs repository?

from undici.

mcollina avatar mcollina commented on June 23, 2024

Possibly, we can investigate if we have a reproduction.

from undici.

KasperiP avatar KasperiP commented on June 23, 2024

I encountered similar issues: 22.3-alpine failed, but after changing to 22.1-alpine, it worked fine.
https://github.com/luuppiry/luuppi-next/actions/runs/9527152450/job/26263513613
https://github.com/luuppiry/luuppi-next/actions/runs/9527336924/job/26263847778

from undici.

mcollina avatar mcollina commented on June 23, 2024

We need a minimal reproduction to be able to fix.

from undici.

KhafraDev avatar KhafraDev commented on June 23, 2024

afaik nextjs patches fetch which likely causes the issue. Without more information it looks like they're not decompressing the body.

from undici.

KhafraDev avatar KhafraDev commented on June 23, 2024

The only PR that touched body was f979ec3, which would have landed in node v22 (undici v6.14.0). We can revert it to be safe, but without a reproduction... cc @tsctx

from undici.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.