cloudflare / cloudflare/workerd

very strange behavior related to fetch()

Open
#5,534 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.7k
Forks
739
Avg merge
2d 20h
Merged PRs (30d)
174

Description

run this code:
```ts
import { FastResponse, serve } from "srvx";

async function searchImageWithGoogle(imageUrl: string) {
const imgRes = await fetch(imageUrl);

const form = new FormData();

form.set("encoded_image", await imgRes.blob());

form.set("sbisrc", "Microsoft Edge 142.0.3595.53 (Official) Linux");

const res = await fetch("https://www.google.com/searchbyimage/upload", {
method: "POST",
body: form,
headers: {
"user-agent":
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0",
},
});

return res.url;
}

serve({
async fetch() {
return FastResponse.redirect(
await searchImageWithGoogle("https://picsum.photos/200/300")
);
},
});
```
in deno and cloudflare you get "Search by image is unavailable. Please try again in a few hours."
in bun and node it works fine
is there something deno and cloudflare do/don't that is different from bun and node? when i remove sbisrc, bun and node start behaving like deno and cloudflare

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.