-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Hyperdrive] nodejs_compat update
#17486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ace4140
Merge commit '599c378d644a2215a21fb38b0ba96e2ae34aaf3e' into jun/kv-h…
Oxyjun 897c0d0
Adding a new partial for compatibility_flags and compatibility_date.
Oxyjun de132a3
Using partial file in the relevant location.
Oxyjun adde1a6
Revert "Using partial file in the relevant location."
Oxyjun 1275c4b
Update src/content/docs/hyperdrive/tutorials/serverless-timeseries-ap…
thomasgauvin 40eaa7a
Updating the compatibility reference in the table.
Oxyjun 22f564e
Update src/content/docs/hyperdrive/configuration/connect-to-postgres.mdx
thomasgauvin 31329a8
Update src/content/docs/hyperdrive/configuration/connect-to-postgres.mdx
thomasgauvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,6 @@ The command above will output the ID of your Hyperdrive, which you will need to | |
|
|
||
| ```toml | ||
| # required for database drivers to function | ||
| compatibility_flags = [ "nodejs_compat_v2" ] | ||
|
|
||
thomasgauvin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [[hyperdrive]] | ||
| binding = "HYPERDRIVE" | ||
|
|
@@ -48,7 +47,7 @@ Hyperdrive uses Workers [TCP socket support](/workers/runtime-apis/tcp-sockets/# | |
| | Driver | Documentation | Minimum Version Required | Notes | | ||
| | ----------------------------- | ---------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| | Postgres.js (**recommended**) | [https://github.com/porsager/postgres](https://github.com/porsager/postgres) | `[email protected]` | Supported in both Workers & Pages. | | ||
| | node-postgres - `pg` | [https://node-postgres.com/](https://node-postgres.com/) | `[email protected]` | `8.11.4` introduced a bug with URL parsing and will not work. `8.11.5` fixes this. Requires the [`nodejs_compat_v2`](/workers/runtime-apis/nodejs/) compatibility flag to be set. Requires wrangler `3.78.7` or later. | | ||
| | node-postgres - `pg` | [https://node-postgres.com/](https://node-postgres.com/) | `[email protected]` | `8.11.4` introduced a bug with URL parsing and will not work. `8.11.5` fixes this. Requires the [`nodejs_compat`](/workers/runtime-apis/nodejs/) `compatibility_flags` and the `compatibility_date` to be set. Requires wrangler `3.78.7` or later. | | ||
Oxyjun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | Drizzle | [https://orm.drizzle.team/](https://orm.drizzle.team/) | `0.26.2`^ | | | ||
| | Kysely | [https://kysely.dev/](https://kysely.dev/) | `0.26.3`^ | | | ||
| | [rust-postgres](https://github.com/sfackler/rust-postgres) | [https://docs.rs/postgres/latest/postgres/](https://docs.rs/postgres/latest/postgres/) | `v0.19.8` | Use the [`query_typed`](https://docs.rs/postgres/latest/postgres/struct.Client.html#method.query_typed) method for best performance. | | ||
Oxyjun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -97,14 +96,9 @@ Install the `node-postgres` driver: | |
| npm install pg | ||
| ``` | ||
|
|
||
| **Ensure you have `compatibility_flags = ["nodejs_compat_v2"]` set in your `wrangler.toml` configuration file**: | ||
| **Ensure you have `compatibility_flags` and `compatibility_date` set in your `wrangler.toml` configuration file** as shown below: | ||
|
|
||
| ```toml | ||
| # other fields elided | ||
| # | ||
| # Required for node-postgres to work | ||
| compatibility_flags = ["nodejs_compat_v2"] | ||
| ``` | ||
| <Render file="nodejs-compat-wrangler-toml" product="workers" /> | ||
|
|
||
| Create a new `Client` instance and pass the Hyperdrive parameters: | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/content/partials/workers/nodejs-compat-wrangler-toml.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| {} | ||
|
|
||
| --- | ||
|
|
||
| ```toml title="wrangler.toml" | ||
| # other fields elided | ||
| # | ||
| # Required for node-postgres to work | ||
| compatibility_flags = [ "nodejs_compat" ] | ||
| compatibility_date = "2024-09-23" | ||
| ``` |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.