#error upgrading to 2.0.0

1 messages · Page 1 of 1 (latest)

cyan token
#
Error: Cannot find module 'payload/database'
Require stack:
- /Users/beewhoo/Documents/capsule/studio/node_modules/@payloadcms/db-mongodb/dist/index.js
Type 'MongooseAdapterResult' is not assignable to type '(args: { payload: Payload; }) => BaseDatabaseAdapter'.
trail junco
#

Please provide some more context, so we can assist. What version of Payload and DB adapter? What does your config look like?

#

Did you go through the release notes about upgrading?

cyan token
# trail junco Please provide some more context, so we can assist. What version of Payload and ...

@trail junco here are the versions and yes followed release notes

"dependencies": {
     "@google-cloud/storage": "^6.10.1",
     "@payloadcms/bundler-webpack": "^1.0.3",
     "@payloadcms/db-mongodb": "^1.0.3",
     "@payloadcms/plugin-cloud-storage": "^1.0.16",
     "@payloadcms/richtext-slate": "^1.0.6",
     "payload": "^2.0.0",
     "payload-plugin-oauth": "^0.3.0",
     "sharp": "^0.32.1",
     "tsconfig": "*",
     "utils": "*"
   },

notice one odd thing, buildConfig db I am getting a typescript error 🤔

  Types of parameters 'args' and 'args' are incompatible.
    Type '{ payload: i``
trail junco
#

Looks like a peer dependency conflict. What package manager are you using? Does the error say specifically what package versions have the conflicting types?

cyan token
# trail junco Looks like a peer dependency conflict. What package manager are you using? Does ...

no issues installing the packages,

here is my config

import { mongooseAdapter } from "@payloadcms/db-mongodb";
import { slateEditor } from "@payloadcms/richtext-slate";
import { webpackBundler } from "@payloadcms/bundler-webpack";
import { buildConfig } from "payload/config";
import Users from "./collections/Users";
import Projects from "./collections/Projects";

export default buildConfig({
  admin: {
    bundler: webpackBundler(),
  },
  editor: slateEditor({}),
  collections: [
    Users,
    Projects,
  ],
  db: mongooseAdapter({
    url: process.env.DATABASE_URI,
  }),
});

here is the error when running server

Error: Cannot find module 'payload/database'
Require stack:
- /Users/beewhoo/Documents/capsule/studio/node_modules/@payloadcms/db-mongodb/dist/index.js
- /Users/beewhoo/Documents/capsule/studio/apps/payload-cms/src/payload.config.ts
- /Users/beewhoo/Documents/capsule/studio/apps/payload-cms/node_modules/payload/dist/config/load.js
- /Users/beewhoo/Documents/capsule/studio/apps/payload-cms/node_modules/payload/dist/payload.js
- /Users/beewhoo/Documents/capsule/studio/apps/payload-cms/node_modules/payload/dist/initHTTP.js
- /Users/beewhoo/Documents/capsule/studio/apps/payload-cms/node_modules/payload/dist/index.js
- /Users/beewhoo/Documents/capsule/studio/apps/payload-cms/src/server.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Function.Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/beewhoo/Documents/capsule/studio/node_modules/@payloadcms/db-mongodb/dist/index.js:13:19)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Object.require.extensions.<computed> [as .js] 

#

typescript error

Type 'MongooseAdapterResult' is not assignable to type '(args: { payload: Payload; }) => BaseDatabaseAdapter'.
  Types of parameters 'args' and 'args' are incompatible.
    Type '{ payload: import("/Users/beewhoo/Documents/capsule/studio/apps/payload-cms/node_modules/payload/dist/payload").Payload; }' is not assignable to type '{ payload: import("/Users/beewhoo/Documents/capsule/studio/node_modules/payload/dist/index").Payload; }'.
      Types of property 'payload' are incompatible.
        Type 'BasePayload<GeneratedTypes>' is missing the following properties from type 'Payload': preferences, mongoURL, mongoOptions, mongoMemoryServerts(2322)
types.d.ts(435, 5): The expected type comes from property 'db' which is declared here on type 'Config'

trail junco
#

Type '{ payload: import("/Users/beewhoo/Documents/capsule/studio/apps/payload-cms/node_modules/payload/dist/payload").Payload; }' is not assignable to type '{ payload: import("/Users/beewhoo/Documents/capsule/studio/node_modules/payload/dist/index").Payload; }'.
Hmm, this typically means that payload's Payload type differs from the adapter's 🤔

#

I'm not sure why that would be the case