Skip to content

[cloudflare] add docs for payload #147

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions pages/cloudflare/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,46 @@ If you see an error similar to:

You are proably using a turbopack enabled build (`next build --turbo`) which is not currently supported by OpenNext.
Change your build command to `next build` to fix the issue.

### Issues with Payload CMS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an howto?

Do we want to mention your PR / a minimal version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move it to howto i guess.

I'm waiting for the PR in payload to be merged, on our side it should be at least 1.0.0, but maybe some of the steps will change by the time it is merged there


If you are using [Payload CMS](https://payloadcms.com/) with `@opennextjs/cloudflare`, you may run into issues while trying to `preview` or `deploy` your app.
Here are a few steps that will let you run Payload CMS with `@opennextjs/cloudflare`:

1. Make sure you are using the latest version of `@opennextjs/cloudflare` and `payload`.
2. Override the `pg` versions in your `package.json` file:

```json
{
"overrides": {
"pg": "^8.15.6"
}
}
```

3. Add `@payloadcms/db-postgres` and `jose` to `serverExternalPackages` in your `next.config.js` file:

```js
export default {
serverExternalPackages: ["@payloadcms/db-postgres", "jose"],
// The rest of your config
};
```

4. Make sure to add `maxUses:1` and `push:false` in your db adapter and `telemetry: false` in your `payload.config.ts` file:

```ts
import { buildConfig } from "payload";
import { postgresAdapter } from "@payloadcms/db-postgres";
export default buildConfig({
telemetry: false,
db: postgresAdapter({
pool: {
connectionString: process.env.DATABASE_URI || "",
maxUses: 1,
},
push: false,
}),
// The rest of your config
});
```