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

[Help](/c/help/9)

# Go serverless function 504 Gateway Timeout with AstraDB secure connect bundle on Vercel

10 views · 1 like · 1 post


Swisscdn (@swisscdn) · 2026-03-28 · ♥ 1

## Problem
All endpoints (including `/swagger` and `/api`) return a **504 Gateway Timeout** error when deployed to my Vercel project, despite working on a different account with the same configuration.

## Current Behavior
- All endpoints return a **504 Gateway Timeout** error.
- Secure connect bundle is provided via `ASTRA_SECURE_BUNDLE_B64` environment variable and extracted at runtime.
- Initialization logs show the bundle is decoded as expected on cold start, but the request still times out.
- The exact same code and identical environment variables work perfectly when deployed to a colleague’s Vercel account.

## Expected Behavior
Endpoints should return successful responses immediately (as they do on the colleague's Vercel project) without 504 errors.

---

## Steps to Reproduce
1. Clone repo: [https://github.com/swisscdn/FiatExServer](https://github.com/swisscdn/FiatExServer)
2. Set Vercel environment variables including valid Astra and DB secrets:
   - `ASTRA_DB_APPLICATION_TOKEN`
   - `ASTRA_DB_ID`
   - `DATABASE_KEYSPACE`
   - `DATABASE_REGION`
   - `ASTRA_SECURE_BUNDLE_B64` (the base64-encoded secure-connect zip)
3. Deploy on Vercel (Go serverless function).
4. Open `/`, `/swagger`, `/user/...` etc.

**Result:** All requests return **504**. Logs show bundle extraction occurs at cold start, but then no further request logs appear before timeout.

## Environment and Init

```go
// Reads ASTRA_SECURE_BUNDLE_B64, decodes to /tmp/secure-connect.zip if needed, then inits DB client.
bundleBase64 := os.Getenv("ASTRA_SECURE_BUNDLE_B64")
// ...decode, write to /tmp if missing...
client, err := astra.NewStaticTokenClient(
    token,
    astra.WithSecureConnectBundle("/tmp/secure-connect.zip"),
    // ...
)
```

**`vercel.json`**

```json
{
  "functions": {
    "api/**": {
      "runtime": "go",
      "includeFiles": "secure-connect-openfiat-test.zip"
    }
  },
  "rewrites": [
    { "source": "/swagger/(.*)", "destination": "/api/root" },
    { "source": "/", "destination": "/api/root" },
    { "source": "/user/(.*)", "destination": "/api/user" }
  ]
}
```

## What I've Tried
- ✅ Verified all env variables & settings match colleague's working setup
- ✅ Cleared and reuploaded bundle base64 string
- ✅ Redeployed both `main` and preview branches
- ✅ Added debug logging; no errors visible, but handler never executes before timeout
- ✅ Exact same code and settings deployed to colleague's Vercel account works perfectly