Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

faiure when running npm run dev. ENOTFOUND error

default discord avatar
miro00632 years ago
8

hi, i have no idea why but now when i start and run npm run dev i get this error


[22:18:50] ERROR (payload): Error: cannot connect to MongoDB. Details: querySrv ENOTFOUND _mongodb._tcp.165687632f9.w3h7.mongodb.net



it was working fine a few days ago but now it does not work, does it have anything to do with my free trial ending, but it ended weeks ago and since I have been able to still use it



@967118574445547650

can you please help

  • discord user avatar
    denolfe
    2 years ago
    does it have anything to do with my free trial ending

    This is likely the case. Free trials that end are spun down if a valid payment method is not able to be charged (plus some grace period). It sounds like this may be the case for you. If you can provide me your Project ID or DM me the email associated, I can take a look.

  • default discord avatar
    miro00632 years ago

    hi

    @967118574445547650

    the email associated is d.anianu@yahoo.com

  • discord user avatar
    denolfe
    2 years ago

    It looks like this was a trial project without an associated payment method. Our policy for trial projects is to remove them at the end of the trial. This was the case for your project



    The code that you write is still yours and safe inside of your github repo, but any associated database or file storage associated with the trial project is no longer available.

  • default discord avatar
    miro00632 years ago

    i want to use the payload cloud eventually, but forst i want to finish developing the project before i pay, how doi switchthe associated database to another one, do I just change the database_uri to a different one

    @967118574445547650
  • discord user avatar
    denolfe
    2 years ago

    You can install mongodb locally and change your .env to point to it



    https://www.mongodb.com/docs/manual/administration/install-community/
  • default discord avatar
    miro00632 years ago
    @967118574445547650

    thanks for the help, I have installed mogodb locally and also have mongo compass, how do i mimic the db structure that payload uses, in my local db, and how do i connect the payload app to the local db. I have changed the db url in the .env file to DATABASE_URI=mongodb://localhost:27017/payload-template-ecommerce


    but when i run i get the same error



    [23:09:24] ERROR (payload): Error: cannot connect to MongoDB. Details: querySrv ENOTFOUND _mongodb._tcp.660c9f1bda2e165687632f9.wyey3h7.mongodb.net

  • discord user avatar
    denolfe
    2 years ago

    It looks like your code is not referencing

    process.env.DATABASE_URI

    . I'd verify that is what is being used for connecting to the DB in your payload config



    Somehow your code is trying to connect to a DB in atlas I'd guess

  • default discord avatar
    miro00632 years ago

    my bad my mistake was that there was duplicate .env files i wass changing a file called example .env. i chanegd the actual .env fil to the db localhost string and it now works. only problem is now after i connect to payload and see the new local database, my front end doesnt work, it just shows a blank page, any tips



    HI

    @191776538205618177

    after successfully changing my project to working with my local db when i load my project i get this message on the front end



    "Welcome to your e-commerce store! Your database is currently empty. To seed your database with a few products and pages, log in to the admin dashboard and click "seed your database". If you have already seeded your database, you may need to hard refresh this page to clear the cached request." I have pressed the seed button and done a hard refresh but nothing is happening, i still get this message, any tips on how to do this, or is there a clone of the eccomernce db i can colen from somewhere into my db because pressing the seed button is not working



    this is the message I get in terminal when i run yarn seed in the terminal yarn seed --verbose


    yarn run v1.22.22


    $ rm -rf media && cross-env PAYLOAD_SEED=true PAYLOAD_DROP_DATABASE=true PAYLOAD_CONFIG_PATH=src/payload/payload.config.ts ts-node src/server.ts --verbose


    (node:75238) [DEP0040] DeprecationWarning: The

    punycode

    module is deprecated. Please use a userland alternative instead.


    (Use

    node --trace-deprecation ...

    to show where the warning was created)


    [23:49:53] INFO (payload): ---- DROPPING DATABASE ----


    unhandledRejection ValidationError: The following field is invalid: copyright


    at beforeChange (/Users/desmondanianu/e-commerce/node_modules/payload/src/fields/hooks/beforeChange/index.ts:60:11)


    at processTicksAndRejections (node:internal/process/task_queues:95:5)


    at async update (/Users/desmondanianu/e-commerce/node_modules/payload/src/globals/operations/update.ts:159:18)


    at async Promise.all (index 6) {


    data: [ { field: 'copyright', message: 'This field is required.' } ],


    isOperational: true,


    isPublic: false,


    status: 400


    }


    [23:49:53] INFO (payload): ---- DROPPED DATABASE ----


    [23:49:53] INFO (payload): Connected to MongoDB server successfully!


    [23:49:53] INFO (payload): Starting Payload...


    [23:49:54] INFO (payload): Payload Admin URL:

    http://localhost:3000/admin

    [23:49:54] INFO (payload): Seeding database...


    [23:49:54] INFO (payload): — Clearing media...


    [23:49:54] INFO (payload): — Clearing collections and globals...


    error Command failed with exit code 1.


    info Visit

    https://yarnpkg.com/en/docs/cli/run

    for documentation about this command.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.