Closed nathanblon closed 8 months ago
Hey @nathanblon, thanks for reporting this. There was indeed a regression in our system that lead to the wrong prefix being set.
The bug has been resolved so connecting a KV store to a project should use the KV_ prefix like our documentation says. If you already connected the store to a project you can delete the connection and re-connect the store to get the new env var names.
Issue Description
When setting up a Vercel KV database and trying to use the environment variables in our Next.js application, I encountered an inconsistency between the variable names mentioned in the Vercel KV documentation and the actual variable names provided by Vercel.
Expected Behavior
According to the Vercel KV documentation, the environment variables for accessing the Vercel KV database should be named KV_REST_API_URL and KV_REST_API_TOKEN.
Actual Behavior
When pulling the environment variables from Vercel using the
vercel env pull .env.development.local
command, the variables are named REDIS_REST_API_URL, REDIS_REST_API_TOKEN, REDIS_URL and REDIS_REST_API_READ_ONLY_TOKEN.Steps to Reproduce
Create a new Vercel project and set up a Vercel KV database (with Primary Region Frankfurt, Germany fra1.) Run vercel env pull .env.development.local to pull the environment variables. Observe that the environment variables are named with the REDIS prefix instead of KV.
Workaround
To work around this issue, I had to manually change the 4 environment variable names in our application code from REDIS_REST_API_URL, REDIS_REST_API_TOKEN, REDIS_URL and REDIS_REST_API_READ_ONLY_TOKEN to KV_REST_API_URL, KV_REST_API_TOKEN, KV_URL and KV_REST_API_READ_ONLY_TOKEN respectively.
Additional Context
It's worth noting that even in the Vercel project dashboard, the environment variables are displayed with the REDIS_ prefix, which further adds to the confusion and inconsistency with the documentation.
Suggested Solution
We kindly request that the Vercel team address this inconsistency by either: Updating the documentation to reflect the actual environment variable names (REDIS_REST_API_URL and REDIS_REST_API_TOKEN) for Vercel KV, or Changing the environment variable names provided by Vercel to match the documentation (KV_REST_API_URL and KV_REST_API_TOKEN).