repack: Promise may not be fulfilled with 'undefined' when statusCode is not 204
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (5 by maintainers)
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 socurl
should terminate the connection due to timeout and it did and I was finally able to see the infamousPromise may not be fulfilled with 'undefined' when statusCode is not 204
.As for the solution: Could someone add
return reply;
to the end of theforwardRequest
(line 234) function insidenode_modules/@callstack/repack/dist/server/DevServerProxy.js
:@zamotany This didn’t fix it for me unfortunately, i receive the exact same error.