Giter VIP home page Giter VIP logo

Comments (7)

jean343 avatar jean343 commented on May 25, 2024

If it helps, I did polyfill it this way

global.Response = class extends Response {
  constructor(body: any, init: any) {
    super(body === "" && init.status === 204 ? null : body, init);
  }
};

from elysia-polyfills.

bogeychan avatar bogeychan commented on May 25, 2024

Hi 👋

thanks for reporting!

Can you send me a small code snippet to reproduce this issue, and the version number used for the following packages, pls:

  • elysia
  • @elysiajs/cors
  • @bogeychan/elysia-polyfills

from elysia-polyfills.

jean343 avatar jean343 commented on May 25, 2024

For sure :)

Here you go https://github.com/jean343/elysia-polyfills-3

from elysia-polyfills.

BLucky-gh avatar BLucky-gh commented on May 25, 2024

I pnmp patch-ed a8a0b15 in over v0.6.3 since it hasn't been released yet

diff --git a/src/env/headers.ts b/src/env/headers.ts
index 819e6234b17ee890c0f82526f3e86dae73e8628c..013eec21d0a9fd791b8dc34a83595344dc523825 100644
--- a/src/env/headers.ts
+++ b/src/env/headers.ts
@@ -27,6 +27,10 @@ globalThis.Request = class Request extends globalThis.Request {
 };
 
 globalThis.Response = class Response extends globalThis.Response {
+  constructor(body?: Bun.BodyInit | null, init?: Bun.ResponseInit) {
+    super(init?.status === 204 ? null : body, init);
+  }
+
   // @ts-expect-error
   get headers() {
     return new globalThis.Headers(

but I'm still getting the same error, at least on aws lambda's node 20.x

Judging by the error message, the issue might not be that there's a body included, but with trying to make a 204 response at all, which is weird (or alternatively the error message is wrong/dumb/unhelpful, which wouldn't be the first time with node)

from elysia-polyfills.

BLucky-gh avatar BLucky-gh commented on May 25, 2024

Nevermind it works, for some reason the patch just didn't get bundled into the lambda bundle, sorry for the misinfo

from elysia-polyfills.

bogeychan avatar bogeychan commented on May 25, 2024

Should be fixed with 0.6.4. Let me know if the issue persists

from elysia-polyfills.

jean343 avatar jean343 commented on May 25, 2024

I confirm that the fix works, thank you.

from elysia-polyfills.

Related Issues (6)

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.