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

Vercel adapter does not allow for a null Response body #84

Closed
aweary opened this issue Jan 29, 2021 · 1 comment
Closed

Vercel adapter does not allow for a null Response body #84

aweary opened this issue Jan 29, 2021 · 1 comment

Comments

@aweary
Copy link

aweary commented Jan 29, 2021

@remix-run/vercel seems to have a problem with me sending a null response with new Response(null, { ...})

{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read property 'pipe' of
null","reason":{"errorType":"TypeError","errorMessage":"Cannot read property 'pipe' of null","stack":["TypeError:
Cannot read property 'pipe' of null","    at sendPlatformResponse (/var/task/node_modules/@remix-
run/vercel/index.js:57:26)","    at /var/task/node_modules/@remix-run/core/adapter.js:41:16"," 
 at processTicksAndRejections (internal/process/task_queues.js:97:5)","    at async Server.<anonymous> (/var/task/___vc_helpers.js:813:13)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection:
TypeError: Cannot read property 'pipe' of null","    at process.<anonymous> (/var/runtime/index.js:35:15)"," 
at process.emit (events.js:326:22)","    at processPromiseRejections (internal/process/promises.js:209:33)","
 at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
Unknown application error occurred

Looking at node_modules:

    if (Buffer.isBuffer(remixResponse.body)) {
      res.end(remixResponse.body);
    } else {
      remixResponse.body.pipe(res);
    }

doesn't look like it accounts for a remixReponse.body that might be null which I believe is valid from what the Fetch API TypeScript types are telling me

@machour
Copy link
Collaborator

machour commented Mar 15, 2022

Fixed in the new vercel integration:

  if (Buffer.isBuffer(response.body)) {
    res.end(response.body);
  } else if (response.body?.pipe) {
    response.body.pipe(res);
  } else {
    res.end();
  }

@machour machour closed this as completed Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants