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

Defer Loader fails to load raw headers from dev server. Works in production. #5489

Closed
1 task done
youngkidwarrior opened this issue Feb 16, 2023 · 5 comments
Closed
1 task done

Comments

@youngkidwarrior
Copy link

youngkidwarrior commented Feb 16, 2023

What version of Remix are you using?

1.12.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

You could clone BrightID Discord Bot

Expected Behavior

Loader returns deferred data properly

Here is a link to the loader (written in Rescript) https://github.com/ShenaniganDApp/brightid-discord-bot/blob/212d4dbdf1fa71682fb7064f923ada2a3a510edc/apps/web/app/res-routes/guilds/GuildId_Index.res#L27

Actual Behavior

remix_failed_raw.mov

I have a loader that is supposed to return deferred data. On page load, the loader is returning undefined for every field.

This is the error:

TypeError: Cannot read properties of undefined (reading 'raw')
    at sendRemixResponse (/Users/username/Documents/BrightIDbot/node_modules/@remix-run/express/dist/server.js:85:65)
    at /Users/username/Documents/BrightIDbot/node_modules/@remix-run/express/dist/server.js:40:13
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

and this is the function the error points to in @remix-run/express

async function sendRemixResponse(res, nodeResponse) {
  res.statusMessage = nodeResponse.statusText;
  res.status(nodeResponse.status);
  for (let [key, values] of Object.entries(nodeResponse.headers.raw())) {  // --> Line 85
    for (let value of values) {
      res.append(key, value);
    }
  }
  if (nodeResponse.body) {
    await node.writeReadableStreamToWritable(nodeResponse.body, res);
  } else {
    res.end();
  }
}

The odd thing is, the exact same code works in production at https://bot.brightid.org, which makes me think it is a dev server issue. I recently updated to v1.12.0, so I tried reverting those changes, however, the issue persisted.

@MaximeGratens
Copy link

Same issue with my project !

@youngkidwarrior youngkidwarrior changed the title Remix Fails to load raw headers from dev server. Works in production. Defer Loader fails to load raw headers from dev server. Works in production. Feb 25, 2023
@youngkidwarrior
Copy link
Author

It seems like this issue is arising from defer(). Not sure how to fix it.

@bluefire2121
Copy link

bluefire2121 commented Apr 4, 2023

This is fixed in 1.14.0 I believe #5345

@robase
Copy link

robase commented Apr 6, 2023

Still hitting this issue using 1.14.3

Edit: Seems to be fixed in 1.15.0

@brophdawg11
Copy link
Contributor

I'm going to close this out since I believe it should have been fixed by #5345 in 1.14.0. Please re-open with a minimal reproduction if this is not the case!

@brophdawg11 brophdawg11 moved this from Backlog to Closed in v2 Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Closed
Development

No branches or pull requests

7 participants