null hyperdrive connectionString parameter

Hello, I have been trying to get to the bottom of why my connection strings from hyperdrive are undefined when deployed to pages. I am using SvelteKit with Cockroach DB. Everything is working fine without hyperdrive.

My wrangler.toml looks like this:
compatibility_flags = ["nodejs_compat"]
compatibility_date = "2024-08-06"

[vars]

[[hyperdrive]]
binding = "HYPERDRIVE"
id = "c020574a-5623-407b-be0c-cd192bab9545"


I am able to get the connection strings locally if I run npx wrangler pages dev (but they don't work, they only get a connection timeout). but atleast I can confirm that I am getting data through the right environment variables.

Also, if I don't add the connection string into the wrangler.toml. I get the error: Error: When developing locally, you should use a local Postgres connection string to emulate Hyperdrive functionality. Please setup Postgres locally and set the value of the 'WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE' variable or "HYPERDRIVE"'s "localConnectionString" to the Postgres connection string. regardless of whether or not I am running it locally or if it is deployed to pages.

I am not confident that sveltekit is picking up the configurations at all but I also am not sure how I would have received the above error if that was the case. This is a log at the start of the pages build:

A wrangler.toml file was found but it does not appear to be valid. Did you mean to use wrangler.toml to configure Pages? If so, then make sure the file is valid and contains the pages_build_output_dir property. Skipping file and continuing.
Was this page helpful?