I’m using Vercel AI Gateway in a Next.js app, and AI image generation works through a shared Event/Offer image generator. The application is deployed on the Vercel Hobby plan.
My Preview deployment consistently returns:
503 configuration_unavailable
for both:
POST /api/ai/event-image-assistPOST /api/ai/offer-image-assist
The failure occurs before provider generation.
Here is what I have already verified:
- Project:
maidencommunityapp - Project ID:
prj_Zh2zpJYFmr0JFMEGEaCSsNc3QK5K - Team:
care-nest-hq - Preview branch:
fix/content-studio-nav - Preview is from the same GitHub repo, not a fork
AI_GATEWAY_API_KEYis configured for Preview and Production- There is no Preview branch filter on the variable
- Secure Backend Access with OIDC Federation is enabled
- Issuer Mode is set to Team (Recommended)
- I redeployed the Preview after confirming OIDC was enabled
The app now checks Gateway auth in this order:
AI_GATEWAY_API_KEYgetVercelOidcToken()from@vercel/oidcx-vercel-oidc-tokenrequest header
The runtime results are:
AI_GATEWAY_API_KEY: not usable in the Preview Function runtimegetVercelOidcToken(): no usable tokenx-vercel-oidc-token: absent- Event Image AI: 503
configuration_unavailable - Offer Image AI: 503
configuration_unavailable
Versions:
ai@7.0.116@ai-sdk/gateway@4.0.94
Latest Preview deployment tested:
6mLkvpgRuzxCnneSSPoytQAwH8E9
Preview URL:
https://maidencommunityapp-git-fix-content-studio-nav-care-nest-hq.vercel.app
I also tested a fresh redeploy after enabling/confirming OIDC, with the same result.
The main question is:
Why would a Vercel Preview Function receive neither the configured AI_GATEWAY_API_KEY nor an OIDC token, even though Preview is enabled for the env variable and OIDC Federation is enabled for the project?
Is there a Hobby-plan limitation, team-level setting, or additional project configuration required for AI Gateway OIDC authentication in Preview Functions?
Any guidance on what I should inspect next would be appreciated.