NEXT_PUBLIC_VERCEL_URL for auto deploy on Vercel #48391
-
SummaryHello, I don't understand how can I use I also tried specifying // next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
output: 'standalone',
swcMinify: true,
env: {
NEXT_PUBLIC_VERCEL_URL: process.env.VERCEL_URL,
},
}
module.exports = nextConfigIn my code it works only for server rendering, but "undefined" type for client: // configs/index.ts
export const VERCEL_URL = process.env.VERCEL_URL ?? process.env.NEXT_PUBLIC_VERCEL_URLI also tried to specify in .env.production. In such a case, I get an empty string "" instead of the expected VERCEL_URL: # .env.production
NEXT_PUBLIC_VERCEL_URL=${VERCEL_URL}Ideally, I would like to automatically receive the current url both on the server and on the client, without manually specifying this information somewhere. Now for deployment, I manually execute the commands I would be grateful for any ideas and tips. Additional informationNo response Examplehttps://github.com/paqstd-dev/vercel-public-url-implementation |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Now it works. I didn't change anything in my code. Perhaps this is a server error of Vercel itself. |
Beta Was this translation helpful? Give feedback.
-
|
I have the same problem. I didn't change the configuration, but it's not working anymore. It used to replace with the correct value, but now I'm getting as a value: |
Beta Was this translation helpful? Give feedback.
Now it works. I didn't change anything in my code. Perhaps this is a server error of Vercel itself.