Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy breaks on responses without body #1275

Open
vushe opened this issue Jun 1, 2023 · 0 comments
Open

Proxy breaks on responses without body #1275

vushe opened this issue Jun 1, 2023 · 0 comments
Labels
bug Something isn't working proxy

Comments

@vushe
Copy link

vushe commented Jun 1, 2023

Environment

Node: 18.15.0
Nuxt 3.5.0 with Nitro 2.4.1
h3: 1.6.6

Describe the bug

Somewhat similar with #1237, but another issue.

Proxy fails (in this particular case when 204 No Content is responded from API) with following error:

"url":"/proxy/customer/change-details?countryCode=FI",
"statusCode":500,
"statusMessage":"",
"message":"Cannot read properties of null (reading 'Symbol(Symbol.asyncIterator)')",
"stack":"<pre><span class=\"stack internal\">at sendProxy (./node_modules/h3/dist/index.mjs:560:38)</span>\n<span class=\"stack internal\">at process.processTicksAndRejections (node:internal/process/task_queues:95:5)</span>\n<span class=\"stack internal\">at async Object.handler (./node_modules/h3/dist/index.mjs:1255:19)</span>\n<span class=\"stack internal\">at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:1330:7)</span></pre>"

In ./node_modules/h3/dist/index.mjs:560:38 we have following:

    for await (const chunk of response.body) {
      event.node.res.write(chunk);
    }

So it looks like check for empty response.body is missing. Following fixes the issue:

  if (response.body) {
    for await (const chunk of response.body) {
      event.node.res.write(chunk);
    }
  }

Additional context

No response

Logs

No response

@pi0 pi0 added bug Something isn't working and removed pending triage labels Jun 1, 2023
@Hebilicious Hebilicious added the proxy label Jun 30, 2023 — with Volta.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working proxy
Projects
None yet
Development

No branches or pull requests

3 participants