#Testing out next-payload repo, but is recieving import error on using postgres adapter

4 messages · Page 1 of 1 (latest)

woeful bloom
#

Hi, does anyone have a similar issue like this error here:

Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> MIT License
| 
| Copyright (c) 2023 libSQL

Import trace for requested module:
./node_modules/@libsql/client/LICENSE
./node_modules/@libsql/ sync ^\.\/.*$
./node_modules/libsql/index.js
./node_modules/@libsql/client/lib-esm/sqlite3.js
./node_modules/@libsql/client/lib-esm/node.js
./node_modules/drizzle-kit/bin.cjs
./node_modules/drizzle-kit/ sync ^.*$
./node_modules/drizzle-kit/payload.js
./node_modules/@payloadcms/db-postgres/dist/connect.js
./node_modules/@payloadcms/db-postgres/dist/index.js
./payload/payload.config.ts
./node_modules/payload/dist/admin/Root.js
./app/(payload)/admin/page.tsx```
This is me trying to enter the admin page. 
And i am using the postgres adapter instead of the mongo adapter that was used in this example:

https://github.com/payloadcms/next-payload

Aka, installing the `@payloadcms/db-postgres` and editing the `payload.config.ts` to use the correct adapter.

```ts
import path from 'path';
import { buildConfig } from 'payload/config';
import { postgresAdapter } from '@payloadcms/db-postgres';
import { slateEditor } from '@payloadcms/richtext-slate';
import { webpackBundler } from '@payloadcms/bundler-webpack';

export default buildConfig({
  db: postgresAdapter({
    pool: {
        connectionString: process.env.POSTGRES_DB_URI,
    }
  }),
  editor: slateEditor({}),
  admin: {
    bundler: webpackBundler(),
  },
  collections: [
    // Your collections here
  ],
  globals: [
    // Your globals here
  ],
  typescript: {
    outputFile: path.resolve(__dirname, '../payload-types.ts'),
  },
});

The project is uploaded to github: https://github.com/ThomasAunvik/next-payload-test

forest sunBOT
woeful bloom
#

Ok, i upgraded the @payloadcms/db-postgres to version 0.1.0-beta.19 , and now it works.

forest sunBOT