Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency pg in production + refresh page error #3080

Open
giticon opened this issue Feb 3, 2025 · 3 comments
Open

dependency pg in production + refresh page error #3080

giticon opened this issue Feb 3, 2025 · 3 comments
Labels

Comments

@giticon
Copy link

giticon commented Feb 3, 2025

Environment

  • Operating System: windows 11 pro
  • Node Version: v22.13
  • Nuxt Version: 3.15.4
  • Nitro Version: 2.10.4
    Server: Vercel
  • Package Manager: Yarn v1.22.19
    package:
package: -
    "dependencies": {
    "@nuxt/content": "^3.0.1",
    "@nuxt/fonts": "^0.10.3",
    "@nuxt/ui": "2.21.0",
    "@nuxtjs/seo": "^2.0.2",
    "nuxt": "^3.15.4",
    "pg": "^8.13.1",
    "sass": "^1.82.0",
    "vue": "latest",
    "vue-router": "latest"
  },
  "devDependencies": {
    "@nuxt/image": "^1.8.1",
    "nuxt-svgo": "^4.0.9"
  }

Version

v3

Reproduction

.

Description

In developer mode I don't have any problems.

However, when I go to production the deployment fails because it tells me that the "pg" dependency is missing.

Installing pg bypasses the problem but the deployment still fails again due to a different error

[nuxt] [request error] [unhandled] [500] connect ECONNREFUSED 127.0.0.1:5432

The point is that if I navigate between the pages the data (markdown + yaml) is displayed correctly in the pages, while if I refresh the data is not loaded.

I have tried the various solutions proposed such as updating the packages and reinstalling node_modules from scratch but the problem persists.

Here are some additional details that might be useful:

  • The error message "connect ECONNREFUSED 127.0.0.1:5432" indicates that the application is trying to connect to a PostgreSQL database on the local machine (127.0.0.1) on port 5432, but the connection is being refused. Nuxt/content uses the default configuration (sqlite). I have also tried to specify in config that it is sqlite but nothing, it does not work: it always gives me the same error.

Additional context

No response

Logs

Copy link
Member

farnabaz commented Feb 3, 2025

In order to deploy on Vercel, Content module requires a small database to store/retrieve contents in performant way.
In Vercel it is not possible yet to create local sqlite database. However there is some database providers that offer free tier to use with Nuxt Content.

For example you can try integrate Neon database to your project. Once you integrate it with your project, just redeploy. Module will automatically detect the database using Vercel's environment variables.

@farnabaz farnabaz added the v3 label Feb 3, 2025 — with Volta.net
@giticon
Copy link
Author

giticon commented Feb 3, 2025

I understand. Thank you for your response. I suspected it was something like that.

The strange thing is that I have another site with this configuration


"devDependencies": {
    "@pinia/nuxt": "0.9.0",
    "nuxt": "^3.15.1",
    "nuxt-svgo": "^4.0.9",
    "pinia": "^2.3.0"
  },
  "dependencies": {
    "@nuxt/content": "^3.0.0",
    "@nuxt/image": "^1.8.1",
    "@nuxt/ui": "^2.20.0",
    "@nuxtjs/sitemap": "^7.2.2",
    "@vueuse/nuxt": "^12.2.0",
    "gsap": "^3.12.5",
    "lite-vimeo-embed": "^0.3.0",
    "lite-youtube-embed": "^0.3.3",
    "nuxt-swiper": "^1.2.2",
    "pg": "^8.13.1",
    "sass": "^1.83.0",
    "vanilla-lazyload": "^19.1.3"
  }

That on Vercel works perfectly without an external db. They are slightly older packages. The server configuration is the same. How come?

Another question: for nuxt which other servers already have a local sqlite db?

@giticon
Copy link
Author

giticon commented Feb 3, 2025

I configured the db within Vercel/Storage. I confirm that with NeonDB it works perfectly without modifying anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants