[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Feedback](/c/feedback/8)

# BUG: vercel fetch to gitlab returns 406

23 views · 0 likes · 1 post


Jan Wilmake (@codefromanywhere1) · 2025-02-07

This returns `true 200` using Bun or workerd (cloudflare) runtime

It's also fine using curl or browser (this is just the link to an archive on gitlab)

```
curl -X GET -v https://gitlab.com/gitlab-com/content-sites/handbook/-/archive/main/handbook-main.zip --output zip.zip
```

However, in vercel it returns `406 Unacceptable`


```
export const GET = async () => {
  const url =
    "https://gitlab.com/gitlab-com/content-sites/handbook/-/archive/main/handbook-main.zip?random=" +
    Math.random();

  console.log({ url });
  const response = await fetch(url)
    .then(async (res) => {
      if (!res.ok) {
        const text = await res.text();
        console.log(res.ok, res.status, { text });
      }
      res.headers.forEach((value, key) => console.log({ key, value }));

      console.log(res.ok, res.status);
    })
    .catch((error) => {
      console.log("Error:", error);
      // Also try to get the response details if available
      if (error instanceof Response) {
        error.text().then((text) => console.log("Error response:", text));
      }
    });
  return new Response("OK?");
};

// export default {
//   fetch: GET,
// };
```

I tried adding many headers to make the request look the same, but in the end I keep getting '406 Unacceptable' for Vercel.

Edit: even when providing a private access token for gitlabs api it returns 406 in vercel when ran as API endpoint. Bun/CloudFlare are totally fine.

I don't know if this is the right place to report this, but I found this behaviour very strange and only occur with the vercel runtime. My guess is that GitLab may block Vercel's IP range, but that would be a weird thing to do, especially considering I also tried it with access token, so it might be a bug on Vercel's side?

Hope someone can shine some light on why this might be happening.