Facing OIDC Token Verification issue in prod

I’m playing around with the AI Gateway and everything was working normally when running locally. When I attempted to deploy it via vercel, I’m running into this error:

AI Gateway error response: {“error”:{“message”:“Error verifying OIDC token\nThe AI Gateway OIDC authentication token is expected to be provided via the ‘VERCEL_OIDC_TOKEN’ environment variable. It expires every 12 hours.\n- make sure your Vercel project settings have OIDC enabled (already on for new projects by default)\n- if you’re running locally with ‘vercel dev’ the token is automatically obtained and refreshed for you\n- if you’re running locally with your own dev server script you can fetch/update the token by running ‘vercel env pull’\n- in production or preview the token is automatically obtained and refreshed for you”,“type”:“authentication_error”}}

I have provided the VERCEL_OIDC_TOKEN env variable but still face this error after redeployment. My Vercel project settings have OIDC enabled by default, and I tried running ‘vercel env pull’ as well, which updated my .env too.

Anyone know what else I should try?

Fixed: Make sure to use the OIDC token rather than the AI Gatway token

Thanks for sharing your solution!

Ok so… that worked for a couple hours and then stopped. Im aware that it expires every 12 hours, but I have not touched any part of the code since changing it and ran into that same error again. If anyone has a solution do let me know.