N
Nuxt2mo ago
YELLI

Nuxt app not getting deployed

Im trying to deploy my nuxt app to vercel but it wont get deployed. And also when ever im using a env file to hide my supabase creds it showing and error
No description
4 Replies
kapa.ai
kapa.ai2mo ago
Hi @YELLI. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I understand you're having issues deploying your Nuxt app to Vercel and encountering problems with environment variables. Let's address these concerns based on the information provided in the knowledge sources. 1. Deploying to Vercel: Nuxt Content projects can be deployed to Vercel with zero configuration. The module automatically detects the Vercel environment and prepares the necessary configuration. To deploy your app, you can either: a) Execute the command: npx vercel deploy b) Go to the Vercel dashboard and create a new project using your git repository If you're still facing issues, make sure you're following the steps outlined in the Vercel documentation for deploying Nuxt apps. 2. Environment Variables: The error you're encountering with your Supabase credentials in the .env file is likely because environment variables are handled differently in production. Here's what you need to know: - In development, Nuxt CLI has built-in support for reading .env files. - However, in production (like when deployed to Vercel), the .env file is not automatically read. To fix this issue: a) Instead of using process.env directly, use the useRuntimeConfig composable in your Nuxt 3 app to access environment variables. b) In your nuxt.config.ts file, define your environment variables in the runtimeConfig section:
export default defineNuxtConfig({
runtimeConfig: {
// Private config that is only available on the server
supabaseSecret: process.env.SUPABASE_SECRET,
// Config within public will be also exposed to the client
public: {
supabaseUrl: process.env.SUPABASE_URL
}
},
})
export default defineNuxtConfig({
runtimeConfig: {
// Private config that is only available on the server
supabaseSecret: process.env.SUPABASE_SECRET,
// Config within public will be also exposed to the client
public: {
supabaseUrl: process.env.SUPABASE_URL
}
},
})
c) Set your environment variables in the Vercel dashboard. Go to your project settings, find the "Environment Variables" section, and add your Supabase credentials there. By following these steps, your Nuxt app should deploy successfully to Vercel, and your environment variables will be properly handled in both development and production environments. For more detailed information on handling environment variables and runtime config in Nuxt 3, refer to the Runtime Config documentation. Vercel deployment guide Environment Variables in Nuxt If you're still encountering issues after following these steps, please provide more specific error messages or logs to help diagnose the problem further. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@1133780654857932841> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
YELLI
YELLIOP2mo ago
the complete error log
No description
YELLI
YELLIOP2mo ago
If you would like my code I can send my git hub repo in dms

Did you find this page helpful?