Skip to content

Commit cbc4f3d

Browse files
Oxyjunthomasgauvin
andauthored
[Hyperdrive] nodejs_compat update (#17486)
* Adding a new partial for compatibility_flags and compatibility_date. * Using partial file in the relevant location. * Revert "Using partial file in the relevant location." This reverts commit de132a3. * Update src/content/docs/hyperdrive/tutorials/serverless-timeseries-api-with-timescale/index.mdx * Updating the compatibility reference in the table. * Update src/content/docs/hyperdrive/configuration/connect-to-postgres.mdx * Update src/content/docs/hyperdrive/configuration/connect-to-postgres.mdx --------- Co-authored-by: Thomas Gauvin <[email protected]>
1 parent 0060ab7 commit cbc4f3d

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/content/docs/hyperdrive/configuration/connect-to-postgres.mdx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ The command above will output the ID of your Hyperdrive, which you will need to
3030

3131
```toml
3232
# required for database drivers to function
33-
compatibility_flags = [ "nodejs_compat_v2" ]
33+
compatibility_flags = ["nodejs_compat"]
34+
compatibility_date = "2024-09-23"
3435

3536
[[hyperdrive]]
3637
binding = "HYPERDRIVE"
@@ -48,7 +49,7 @@ Hyperdrive uses Workers [TCP socket support](/workers/runtime-apis/tcp-sockets/#
4849
| Driver | Documentation | Minimum Version Required | Notes |
4950
| ----------------------------- | ---------------------------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
5051
| Postgres.js (**recommended**) | [https://github.com/porsager/postgres](https://github.com/porsager/postgres) | `[email protected]` | Supported in both Workers & Pages. |
51-
| 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. |
52+
| 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 `compatibility_flags = ["nodejs_compat"]` and `compatibility_date = "2024-09-23"` - refer to [Node.js compatibility](/workers/runtime-apis/nodejs). Requires wrangler `3.78.7` or later. |
5253
| Drizzle | [https://orm.drizzle.team/](https://orm.drizzle.team/) | `0.26.2`^ | |
5354
| Kysely | [https://kysely.dev/](https://kysely.dev/) | `0.26.3`^ | |
5455
| [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. |
@@ -97,14 +98,9 @@ Install the `node-postgres` driver:
9798
npm install pg
9899
```
99100

100-
**Ensure you have `compatibility_flags = ["nodejs_compat_v2"]` set in your `wrangler.toml` configuration file**:
101+
**Ensure you have `compatibility_flags` and `compatibility_date` set in your `wrangler.toml` configuration file** as shown below:
101102

102-
```toml
103-
# other fields elided
104-
#
105-
# Required for node-postgres to work
106-
compatibility_flags = ["nodejs_compat_v2"]
107-
```
103+
<Render file="nodejs-compat-wrangler-toml" product="workers" />
108104

109105
Create a new `Client` instance and pass the Hyperdrive parameters:
110106

src/content/docs/hyperdrive/tutorials/serverless-timeseries-api-with-timescale/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ This command outputs your Hyperdrive ID. You can now bind your Hyperdrive config
145145
```toml
146146
name = "timescale-api"
147147
main = "src/index.ts"
148-
compatibility_date = "2024-08-21"
149-
compatibility_flags = [ "nodejs_compat_v2"]
148+
compatibility_date = "2024-09-23"
149+
compatibility_flags = [ "nodejs_compat"]
150150

151151
[[hyperdrive]]
152152
binding = "HYPERDRIVE"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
{}
3+
4+
---
5+
6+
```toml title="wrangler.toml"
7+
# other fields elided
8+
#
9+
# Required for node-postgres to work
10+
compatibility_flags = [ "nodejs_compat" ]
11+
compatibility_date = "2024-09-23"
12+
```

0 commit comments

Comments
 (0)