fix(db-postgres): force pg-cloudflare to be installed when using pnpm #14181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Forces
pg-cloudflare
dependency to be installed, even when usingpnpm install
Why?
When using the
db-postgres
adapter inside Cloudflare, it needs thepg-cloudflare
package to work, which is an optional dependency ofpg
. This is necessary to support connecting to a Postgres database, via Cloudflare's Hyperdrive, when deploying Payload on Cloudflare.Optional dependencies are installed by default when using npm, but not when using pnpm.
How?
By declaring
pg-cloudflare
as a dependency ofdb-postgres
.To help with the bundling, it's also necessary to add
pg-cloudflare
to the list of Next.js' external dependencies. More info here: https://opennext.js.org/cloudflare/howtos/workerd#configurationDiscord discussion: https://discordapp.com/channels/967097582721572934/1427199951766552586