nuxt3 + prisma + PostgreSQL deployment
Hello guys. I made an application on nuxt3 + prisma(PostgreSQL). At first, I developed the application locally and everything worked. But when I made a deployment on Vercel, something went wrong. My front-end is working (at least the registration and authorization pages), but apparently the APIs that are supposed to work with the database are not working. In the browser console, I get this error: Uncaught TypeError: Failed to resolve module specifier ".prisma/client/index-browser". Relative references must start with either "/", "./", or "../". Please help.
Here is the link to the github:https://github.com/Xromosoma-STraha/l
GitHub
GitHub - Xromosoma-STraha/l
Contribute to Xromosoma-STraha/l development by creating an account on GitHub.
2 Replies
Hi @Nkt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in your question and the knowledge sources available, I can offer some insights and suggestions regarding your Nuxt 3 + Prisma + PostgreSQL deployment issue on Vercel. However, please note that the knowledge sources don't contain specific information about your exact setup, so I'll provide general guidance.
The error you're encountering suggests that there's an issue with how Prisma is being imported or used in your browser-side code. This is likely because Prisma is primarily designed for server-side use, not client-side.
Here are some steps you can take to troubleshoot and potentially resolve the issue:
1. Ensure that you're not importing Prisma directly in any client-side code. Prisma should only be used in server-side code, such as in your API routes or server middleware.
2. Check your Nuxt configuration to make sure you're not accidentally exposing Prisma to the client. In your
nuxt.config.ts
, make sure you're not including Prisma in any client-side bundles.
3. Review your API routes (in the server/api
directory) to ensure they're properly set up to handle database operations using Prisma.
4. Make sure your Vercel deployment is properly configured to handle server-side rendering and API routes. You might need to adjust your Vercel configuration to ensure it's running your Nuxt application correctly.
5. Check if your PostgreSQL database is properly connected and accessible from your Vercel deployment. You may need to configure environment variables in Vercel to provide the correct database connection string.
For more detailed guidance on deploying Nuxt 3 applications, you can refer to the official Nuxt documentation on deployment:
Nuxt Deployment Documentation
If you continue to face issues, you might want to create a minimal reproduction of the problem and seek help from the Nuxt community. The Nuxt documentation provides guidance on how to report bugs and get help:
Nuxt Community: Getting Help
Nuxt Community: Reporting Bugs
Remember to remove any sensitive information like database credentials before sharing your code publicly.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@407890467666001922> Kapa.ai is still learning and improving, please let me know how I did by reacting below.