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

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
  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

// 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

{
  "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

  • :white_check_mark: Verified all env variables & settings match colleague’s working setup
  • :white_check_mark: Cleared and reuploaded bundle base64 string
  • :white_check_mark: Redeployed both main and preview branches
  • :white_check_mark: Added debug logging; no errors visible, but handler never executes before timeout
  • :white_check_mark: Exact same code and settings deployed to colleague’s Vercel account works perfectly
1 Like