edge-runtime
edge-runtime copied to clipboard
Deno fetch: error sending request for url
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
I'm encountering an issue with a Deno function deployed on Supabase Edge Functions where a fetch call itself intermittently fails (over half the time). It's odd that it sometimes works and sometimes not. The error is a generic TypeError: error sending request for url (xxx), and the URL itself is valid — accessing it manually in a browser works without any problems. The only variation between requests is in the URL query parameters. Importantly, this issue seemingly only occurs in the deployed environment; I have not been able to reproduce it when running the function locally. Since the error is thrown by fetch itself (not from the response), and given its inconsistency, it seems like it could be related to the Edge environment or Deno's networking layer?
My project is open-source, so feel free to check the source code. The error must be originating from this line of code: https://github.com/Revadike/SteamKey.Trade/blob/master/supabase/functions/_processors/ggdeals-details.js#L23
I've checked with the API provider (gg.deals). The only errors they see are invalid API keys, but those are likely to be explained by manually visiting the URL without API key. I always use Deno.env.get() as API key in the header, so I don't think that is it. Besides, that would cause an error in the response, not with fetch itself. The error message would be different, as I catch and throw different errors at different places (see source code).
Here is the full error log from the edge function:
{
"event_message": "{\"success\":false,\"message\":\"Encountered 1 errors and failed to process 100 of 400 apps\",\"timestamp\":\"2025-04-28T10:57:21.004Z\",\"details\":{\"ggdealsDetails\":{\"errors\":[\"error sending request for url (https://api.gg.deals/steamkeytrade/game/by-steam-app-id/?ids=453700%2C453710%2C453720%2C453730%2C453740%2C453750%2C453770%2C453780%2C453790%2C453810%2C453820%2C453830%2C453850%2C453860%2C453870%2C453880%2C453890%2C453900%2C453910%2C453950%2C453960%2C453980%2C453990%2C454000%2C454010%2C454030%2C454060%2C454070%2C454100%2C454110%2C454120%2C454130%2C454140%2C454160%2C454170%2C454180%2C454190%2C454200%2C454220%2C454230%2C454240%2C454250%2C454260%2C454320%2C454330%2C454340%2C454350%2C454380%2C454390%2C454410%2C454420%2C454450%2C454480%2C454520%2C454530%2C454540%2C454550%2C454570%2C454580%2C454610%2C454630%2C454640%2C454650%2C454660%2C454670%2C454690%2C454700%2C454720%2C454730%2C454750%2C454770%2C454780%2C454790%2C454791%2C454800%2C454830%2C454870%2C454890%2C454900%2C454950%2C454960%2C454970%2C455020%2C455030%2C455040%2C455041%2C455080%2C455100%2C455110%2C455120%2C455160%2C455170%2C455190%2C455200%2C455220%2C455221%2C455222%2C455223%2C455224%2C455230)\"],\"failed\":[{\"id\":453700},{\"id\":453710},{\"id\":453720},{\"id\":453730},{\"id\":453740},{\"id\":453750},{\"id\":453770},{\"id\":453780},{\"id\":453790},{\"id\":453810},{\"id\":453820},{\"id\":453830},{\"id\":453850},{\"id\":453860},{\"id\":453870},{\"id\":453880},{\"id\":453890},{\"id\":453900},{\"id\":453910},{\"id\":453950},{\"id\":453960},{\"id\":453980},{\"id\":453990},{\"id\":454000},{\"id\":454010},{\"id\":454030},{\"id\":454060},{\"id\":454070},{\"id\":454100},{\"id\":454110},{\"id\":454120},{\"id\":454130},{\"id\":454140},{\"id\":454160},{\"id\":454170},{\"id\":454180},{\"id\":454190},{\"id\":454200},{\"id\":454220},{\"id\":454230},{\"id\":454240},{\"id\":454250},{\"id\":454260},{\"id\":454320},{\"id\":454330},{\"id\":454340},{\"id\":454350},{\"id\":454380},{\"id\":454390},{\"id\":454410},{\"id\":454420},{\"id\":454450},{\"id\":454480},{\"id\":454520},{\"id\":454530},{\"id\":454540},{\"id\":454550},{\"id\":454570},{\"id\":454580},{\"id\":454610},{\"id\":454630},{\"id\":454640},{\"id\":454650},{\"id\":454660},{\"id\":454670},{\"id\":454690},{\"id\":454700},{\"id\":454720},{\"id\":454730},{\"id\":454750},{\"id\":454770},{\"id\":454780},{\"id\":454790},{\"id\":454791},{\"id\":454800},{\"id\":454830},{\"id\":454870},{\"id\":454890},{\"id\":454900},{\"id\":454950},{\"id\":454960},{\"id\":454970},{\"id\":455020},{\"id\":455030},{\"id\":455040},{\"id\":455041},{\"id\":455080},{\"id\":455100},{\"id\":455110},{\"id\":455120},{\"id\":455160},{\"id\":455170},{\"id\":455190},{\"id\":455200},{\"id\":455220},{\"id\":455221},{\"id\":455222},{\"id\":455223},{\"id\":455224},{\"id\":455230}]}}}\n",
"id": "c159c1e4-5ae1-47c4-a51b-b94c3d7bc760",
"metadata": [
{
"boot_time": null,
"cpu_time_used": null,
"deployment_id": "wntawjamotflwwvnskph_7fd7892f-45dc-491a-81a5-6b2508d655af_2",
"event_type": "Log",
"execution_id": "561cb7a6-0701-471d-b860-283523b1c5c0",
"function_id": "7fd7892f-45dc-491a-81a5-6b2508d655af",
"level": "log",
"memory_used": [],
"project_ref": "wntawjamotflwwvnskph",
"reason": null,
"region": "eu-central-1",
"served_by": "supabase-edge-runtime-1.67.3 (compatible with Deno v1.45.2)",
"timestamp": "2025-04-28T10:57:21.005Z",
"version": "2"
}
],
"timestamp": 1745837844912655
}
The specific error in question here (ignoring the irrelevant log details):
error sending request for url (https://api.gg.deals/steamkeytrade/game/by-steam-app-id/?ids=453700%2C453710%2C453720%2C453730%2C453740%2C453750%2C453770%2C453780%2C453790%2C453810%2C453820%2C453830%2C453850%2C453860%2C453870%2C453880%2C453890%2C453900%2C453910%2C453950%2C453960%2C453980%2C453990%2C454000%2C454010%2C454030%2C454060%2C454070%2C454100%2C454110%2C454120%2C454130%2C454140%2C454160%2C454170%2C454180%2C454190%2C454200%2C454220%2C454230%2C454240%2C454250%2C454260%2C454320%2C454330%2C454340%2C454350%2C454380%2C454390%2C454410%2C454420%2C454450%2C454480%2C454520%2C454530%2C454540%2C454550%2C454570%2C454580%2C454610%2C454630%2C454640%2C454650%2C454660%2C454670%2C454690%2C454700%2C454720%2C454730%2C454750%2C454770%2C454780%2C454790%2C454791%2C454800%2C454830%2C454870%2C454890%2C454900%2C454950%2C454960%2C454970%2C455020%2C455030%2C455040%2C455041%2C455080%2C455100%2C455110%2C455120%2C455160%2C455170%2C455190%2C455200%2C455220%2C455221%2C455222%2C455223%2C455224%2C455230)"
It's able to send other requests just fine, btw. It's something about this endpoint.