https://discord.gg/botpress logo
Custom action fetch() failing — Failed to fetch (r...
# 🤝help
s
Hi, just submitted a bug report (report_01M07RJ0NEN0KTGZ64DQHY40X8) for a custom action whose fetch() calls are failing with "Failed to fetch" on every request, confirmed it's not my code, same failure happens against an unrelated public test endpoint too, and reproduces in the Emulator. Workspace: BENVI Collective, bot: Hage Hall. Would appreciate a hand looking into it when someone's free.
d
Since the fetch() call is failing even against an unrelated public endpoint and it also reproduces in the Botpress Emulator, that points more toward an environment/runtime or networking issue than the action code itself. Botpress supports fetch() in custom code, so I’d be happy to help isolate the cause and test a workaround if needed. @straight-jordan-21548
s
Thanks Jason, appreciate the quick response. Happy to help isolate it, whatever's useful on my end. A bit more context that might help narrow it down: this action worked previously (an earlier version of it, with a slightly smaller payload, was tested successfully). It's been failing consistently since earlier today, every attempt, same "Failed to fetch" within under a second each time, both via the live WhatsApp channel and reproduced directly in the Emulator. Times today it failed (my local time, GMT+2): around 09:36, 10:13, 13:26, and 13:33. Let me know if you'd like me to try anything specific, I can test changes and get you results within a couple of minutes since I'm already set up in the Emulator. @dazzling-helicopter-98150
d
Thanks, that context is really helpful. Given it worked previously and is now failing consistently across both WhatsApp and the Emulator even against a public endpoint, I agree this looks more like a runtime/networking issue than the payload or action logic. Could you try one minimal "fetch()" to a simple public endpoint (e.g. "https://httpbin.org/get") and let me know whether that also fails? If it does, we’ll have a clean reproduction case to narrow down the runtime side. @straight-jordan-21548 Accept my friend request and send that to my DM
s
Update on report_01M07RJ0NEN0KTGZ64DQHY40X8: Tried axios instead of fetch() in the same custom action, same target endpoint (https://httpbin.org/get). Different result this time: instead of "Failed to fetch" with no response, axios returned an actual HTTP response, 503 Service Unavailable. Full error: Request failed with status code 503. So a response is coming back now, just not a working one. That reads differently to me than the earlier fetch failures, it looks like something on the request path is answering with 503 rather than the connection failing outright. Wanted to flag this since it's more specific than what I had before. Happy to send the full transpiled error log if useful.
New finding, and this one's more specific. Tried a call to Botpress's own API via the pre-installed client object (client.getBot()) instead of an external URL. It got a real response back: "The provided UUID is invalid." That's Botpress's own server validating and rejecting bad input, a proper round trip, not a network failure. So now the pattern is: calls to Botpress's own API get real responses. Calls to the public internet (httpbin.org) either get nothing back at all (fetch) or a 503 (axios). That suggests this is specific to outbound internet requests from this workspace, not the code execution runtime generally. Hope that narrows down where to look.
6 Views