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.

Errors when installing postgres.js

default discord avatar
hayskapoy2 years ago
4

Mostly about webpack polyfills. Everything fails to start when installing this package.

  • discord user avatar
    tylandavis
    2 years ago

    Hi

    @712127536326246413

    , can you share the errors you are getting?

  • default discord avatar
    hayskapoy2 years ago

    Hello

    @783701636165402624

    !



    I'm getting this error in the browser console and the payload admin does not load


    Uncaught ReferenceError: Buffer is not defined

    And i am using this webpack aliases in my payload config


    config.resolve.alias = {
            ...config.resolve.alias,
            [path.resolve(__dirname, "services/neondb.js")]: mockModulePath,
            [path.resolve(__dirname, "clients/neondb.js")]: mockModulePath,
          }
  • discord user avatar
    tylandavis
    2 years ago

    hmm, your aliases look correct to me. I guess it would depend on how you are using the package. I've only used the aliasing with hooks, is that how you are using it or some other way?

  • default discord avatar
    hayskapoy2 years ago

    Hi

    @783701636165402624

    ! I finally got it working. I just followed what the payload website is using at

    https://github.com/payloadcms/website-cms/blob/main/src/payload.config.ts

    Basically i needed to create emptyModuleMock.js (NOT

    .ts

    ) not sure if the contents matter but i also copied it. Then i removed

    .js

    from

    path.resolve

    calls then it worked 😌

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.