Mitya
Mitya
CDCloudflare Developers
Created by Mitya on 1/9/2025 in #workers-help
Hyperdrive fails to connect in `scheduled()` (but works over HTTP)
There's definitely something fishy here; without any changes, everything just started working again i.e. the DB connected. I refresh, and it's back to the above error with CF saying it can't read the HD connection string. Refresh 10 more times, same error. On the 11th time, it works 🤷
8 replies
CDCloudflare Developers
Created by Mitya on 1/9/2025 in #workers-help
Hyperdrive fails to connect in `scheduled()` (but works over HTTP)
Thanks, really appreciate it. If it helps, I used to get this error every time I made code changes while testing schedules, i.e. the next time I visited the /__schedule endpoint after Wrangler's HMR had uploaded the changes. I'd then refresh, and it would work fine. But that first time, after code changes, I'd always get this. Now suddenly I get it constantly.
8 replies
CDCloudflare Developers
Created by Mitya on 1/9/2025 in #workers-help
Hyperdrive fails to connect in `scheduled()` (but works over HTTP)
Just to be clear, with the above setup:
export default {
fetch: (req, env) => console.log(env.db.connectionString), //exists
scheduled: (evt, env) => console.log(env.db.connectionString) //undefined
}
export default {
fetch: (req, env) => console.log(env.db.connectionString), //exists
scheduled: (evt, env) => console.log(env.db.connectionString) //undefined
}
8 replies
CDCloudflare Developers
Created by Mitya on 1/9/2025 in #workers-help
Hyperdrive fails to connect in `scheduled()` (but works over HTTP)
From the docs:
To access your production (remote) Hyperdrive configuration, pass the --remote flag
This is what I'm doing. My dev DB is remote, and is created as a HD, and I connect to it locally via --remote.
8 replies
CDCloudflare Developers
Created by Mitya on 1/9/2025 in #workers-help
Hyperdrive fails to connect in `scheduled()` (but works over HTTP)
Hi - could you possibly elaborate? This is the setup I've had for over a year and it works perfectly over HTTP?
8 replies
CDCloudflare Developers
Created by Mitya on 1/6/2025 in #workers-help
With the `scheduled` handler, what's the difference between waitUntil and just using async/await?
Thank you, much appreciated.
20 replies
CDCloudflare Developers
Created by Mitya on 1/6/2025 in #workers-help
"SyntaxError: Unexpected end of JSON input" in wrangler-dist/cli.js
Much appreciated.
18 replies