Coder Social home page Coder Social logo

Comments (15)

zamotany avatar zamotany commented on June 6, 2024 3

Ok I think I found a solution.

I've checked the code and the timeout is set for 5mins so it's not the timeout inside Re.Pack than might be causing the issue, but then I've added short timeout to the request for a bundle: curl "http://localhost:8081/index.bundle?platform=ios" --max-time 10 - the bundle compilation takes around 20+s in TesterApp so curl should terminate the connection due to timeout and it did and I was finally able to see the infamous Promise may not be fulfilled with 'undefined' when statusCode is not 204.

As for the solution:
Could someone add return reply; to the end of the forwardRequest (line 234) function inside node_modules/@callstack/repack/dist/server/DevServerProxy.js:

  async forwardRequest(platform, request, reply) {
    if (!this.workers[platform]) {
      await this.runWorker(platform);
    }

    const {
      port
    } = await this.workers[platform];
    const host = request.headers[':authority'] || request.headers.host;
    const url = request.headers[':path'] || request.raw.url;

    if (!url || !host) {
      reply.code(500).send();
    } else {
      const compilerWorkerUrl = `http://localhost:${port}${url}`;
      this.fastify.log.debug({
        msg: 'Fetching from worker',
        url: compilerWorkerUrl,
        method: request.method,
        body: request.body
      });
      reply.from(compilerWorkerUrl);
    }
+   return reply;
  }

from repack.

tom-sherman avatar tom-sherman commented on June 6, 2024 1

@zamotany This didn't fix it for me unfortunately, i receive the exact same error.

from repack.

zamotany avatar zamotany commented on June 6, 2024

Does this happen on a fresh project as well?

from repack.

milesj avatar milesj commented on June 6, 2024

No, just ours. I think our project may be too big. With metro, our bundle is 25mb+. When trying to use repack, our bundle is about 50mb, and almost always runs out of memory while trying to bundle.

from repack.

roshan-lmi avatar roshan-lmi commented on June 6, 2024

Also happening in one of my project. The bundle size is big for me too.

from repack.

geroale avatar geroale commented on June 6, 2024

Same issue here

from repack.

andreszuluaga-wolox avatar andreszuluaga-wolox commented on June 6, 2024

me too, I refresh the project and this run ok

from repack.

mahi8813 avatar mahi8813 commented on June 6, 2024

Any clue on how ti solve this bug.? Any help would be appreciated

from repack.

zamotany avatar zamotany commented on June 6, 2024

Unfortunately, I don't have any clues. Unless someone provides a reproduction project and I can use, the chances of fixing it are slim.

from repack.

tom-sherman avatar tom-sherman commented on June 6, 2024

This happens to me also on our relatively large project but I don't run out of memory. It seems like a timeout is being hit in the dev server as the build process continues (as seen in the dashboard). When I wait for the build to finish and reload the app everything is "fine". (quotes because I have issues with some modules, will create a separate issue for these)

This case might be simple to fix by removing/extending a timeout?

from repack.

zamotany avatar zamotany commented on June 6, 2024

This case might be simple to fix by removing/extending a timeout?

It's worth a shot. I can provide a diff what to edit and alter the timeout and I'd appreciate if someone can apply it and see if the issue still persists.

from repack.

tom-sherman avatar tom-sherman commented on June 6, 2024

Sure, I can try this on our codebase 👍

Just to note tho, we're not currently running repack in production. It's only implemented on a WIP/POC branch right now.

from repack.

joe06102 avatar joe06102 commented on June 6, 2024

Ok I think I found a solution.

I've checked the code and the timeout is set for 5mins so it's not the timeout inside Re.Pack than might be causing the issue, but then I've added short timeout to the request for a bundle: curl "http://localhost:8081/index.bundle?platform=ios" --max-time 10 - the bundle compilation takes around 20+s in TesterApp so curl should terminate the connection due to timeout and it did and I was finally able to see the infamous Promise may not be fulfilled with 'undefined' when statusCode is not 204.

As for the solution: Could someone add return reply; to the end of the forwardRequest (line 234) function inside node_modules/@callstack/repack/dist/server/DevServerProxy.js:

  async forwardRequest(platform, request, reply) {
    if (!this.workers[platform]) {
      await this.runWorker(platform);
    }

    const {
      port
    } = await this.workers[platform];
    const host = request.headers[':authority'] || request.headers.host;
    const url = request.headers[':path'] || request.raw.url;

    if (!url || !host) {
      reply.code(500).send();
    } else {
      const compilerWorkerUrl = `http://localhost:${port}${url}`;
      this.fastify.log.debug({
        msg: 'Fetching from worker',
        url: compilerWorkerUrl,
        method: request.method,
        body: request.body
      });
      reply.from(compilerWorkerUrl);
    }
+   return reply;
  }

returning the reply works for me!

from repack.

github-actions avatar github-actions commented on June 6, 2024

This issue has been marked as stale because it has been inactive for 30 days. Please update this issue or it will be automatically closed in 14 days.

from repack.

github-actions avatar github-actions commented on June 6, 2024

This issue has been automatically closed because it has been inactive for more than 14 days. Please reopen if you want to add more context.

from repack.

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.