Errors when installing postgres.js

default discord avatar
hayskapoy
2 months ago
4

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

  • discord user avatar
    tylandavis
    Payload Team
    2 months ago

    Hi @hayskapoy, can you share the errors you are getting?

  • default discord avatar
    hayskapoy
    2 months ago

    Hello @tylandavis !



    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
    Payload Team
    2 months 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
    hayskapoy
    2 months ago

    Hi @tylandavis ! 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 😌

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.