question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promise may not be fulfilled with 'undefined' when statusCode is not 204

See original GitHub issue

Environment

react-native 0.64.2 @callstack/repack 2.5.1

Description

I seem to get this error a lot and I’m not sure why, as there’s no other information. It only happens when bundling ios, not android. Here’s the full console log.

ℹ [21:46:13.025Z][DevServerProxy] Starting compiler worker { platform: 'ios', port: 64743 }
ℹ [21:46:13.074Z][DevServerProxy] Hermes device connected { deviceId: 2 }
ℹ [21:46:14.087Z][DevServer@ios] Server listening at http://[::]:64743
ℹ [21:46:14.088Z][DevServerProxy] fetching from remote server {
  source: 'http://localhost:64743/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.coinbase.OnboardingMobile'
}
ℹ [21:46:14.094Z][DevServerProxy] fetching from remote server { source: 'http://localhost:64743/api/dashboard/stats?platform=ios' }
ℹ [21:46:14.129Z][webpack-dev-middleware] wait until bundle finished: /index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.coinbase.OnboardingMobile
ℹ [21:46:14.130Z][DevServer@ios] Dashboard client connected { clientId: 'client#0' }
ℹ [21:46:14.132Z][webpack-dev-middleware] wait until bundle finished: /api/dashboard/stats?platform=ios
✖ [21:47:13.971Z][DevServerProxy] Promise may not be fulfilled with 'undefined' when statusCode is not 204 {
  err: {
    type: 'FastifyError',
    message: "Promise may not be fulfilled with 'undefined' when statusCode is not 204",
    stack: "FastifyError: Promise may not be fulfilled with 'undefined' when statusCode is not 204\n" +
      '    at /Users/milesjohnson/Projects/react-native/node_modules/fastify/lib/wrapThenable.js:30:30',
    name: 'FastifyError',
    code: 'FST_ERR_PROMISE_NOT_FULFILLED',
    statusCode: 500
  }
}

Reproducible Demo

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
zamotanycommented, Mar 4, 2022

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;
  }
1reaction
tom-shermancommented, Apr 1, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise may not be fulfilled with 'undefined' when statusCode ...
Promise may not be fulfilled with 'undefined' when statusCode is not 204 ... when statusCode is not 204","stack":"Error: Promise may not be ...
Read more >
node.js - Fastify "Promise may not be fulfilled with 'undefined ...
I am learning Fastify and created a post route. My code for the same is as below: const route = async (fastify) =>...
Read more >
FST_ERR_PROMISE_NOT_FUL...
"message": "Promise may not be fulfilled with 'undefined' when statusCode is not 204", "stack": "FastifyError: Promise may not be fulfilled ...
Read more >
Errors - Fastify
In Node.js, uncaught errors are likely to cause memory leaks, file descriptor leaks, and other major production issues. Domains were a failed attempt...
Read more >
Fastify - Breword 文档集合
A promise may not be fulfilled with 'undefined' when statusCode is not 204. FST_ERR_SEND_UNDEFINED_ERR. Undefined error has occurred.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found