Open nathankleyn opened 5 months ago
@nathankleyn can you give it a try in Bun v1.1.8? @nektro fixed some things in node:http which might help here (notably: adding .agent
as a getter)
bun upgrade --canary
@Jarred-Sumner Thanks for super fast reply! On it and will report back ASAP π π
@Jarred-Sumner Just gave it a go in production with 1.1.8-canary.1+f52c17781
β unfortunately still the same issue with the same response as above.
Let me know if there's anything I can do to help make this more easily reproducible or test anything at all, we're at your disposal as I know the case above is not easy to reproduce standalone!
@nathankleyn if you start the script with --conditions=worker
set, does that fix it? my hunch is:
1) There is a bug in bun's node:http
implementation where the agent
in use by stripe
is for http
and not for https
: https://github.com/stripe/stripe-node/blob/d14e271ff7ab285cc264bca1ea3781829266d5bb/src/net/NodeHttpClient.ts#L50
2) This bug did not manifest in Bun v1.0.xx because previously the "worker"
ESM condition was included which caused "stripe"
to load the fetch
-based implementation (which does not have this bug) rather than the node:http
implementation (which does have this bug)
3) This bug only manifests when an error occurs and the request is retried.
Hey @Jarred-Sumner β thanks so much yet again for the super speed reply and debugging here! I can confirm adding --conditions=worker
has resolved the issue on both 1.1.7+b0b7db5c0
and 1.1.8-canary.1+f52c17781
.
Thank you so much for helping us get back up and running again β if there anything we can do to assist with the proper fix from here to the agent change, we're super happy to test or reproduce anything that you need. We'll also keep an eye on that Stripe PR you raised and see what happens once that gets merged too.
@Jarred-Sumner it seems like the PR has been merged but I just ran in to this issue. It was definitely an issue with Bun as when I tried it with Node it worked fine. I'm using Bun 1.1.20.
What version of Bun is running?
1.1.7+b0b7db5c0
What platform is your computer?
Linux 5.15.60+ x86_64 unknown
What steps can reproduce the bug?
oven/bun:1.1.7-debian
to Google Cloud RunWhat is the expected behavior?
The call should work and return an object of the form:
What do you see instead?
The call fails with an exception:
Caused by:
Additional information
The actual response from the Stripe API under the covers is:
The URL of the API Stripe is actually calling to is to:
^ Note the
http
but the port:443
.It seems that before Bun 1.1.0, the
https
was being inferred because of the port (?) but on every version between 1.1.0 and 1.1.7 thehttp
is being left causing this error upstream.It's worth noting that I cannot seem to reproduce this issue outside of GCP β it only seems to happen there. If I try to run the same Docker container on Orbstack locally, or the app directly on MacOS, all works fine β this is mystifying as I'm trying to make it reproducible for you but have really struggled to make it easier!
Our company is encountering this issue in production which is blocking us from upgrading to Bun 1.1.x. Pinning to Bun 1.0.36 resolves the issue.