🐛 BUG: Unable to use D1 locally
See original GitHub issueWhat version of Wrangler
are you using?
2.2.1
What operating system are you using?
Mac
Describe the Bug
TEST_DB database is undefined instead of BetaDatabase {} upon checking the context.env.
npx wrangler@2.2.1 pages dev ./public --d1=TEST_DB --local-protocol https --local --persist --log-level debug
console.log(env)
{ ASSETS: Fetcher {}, TEST_DB: undefined }
npx wrangler@2.2.0 pages dev ./public --d1=TEST_DB --local-protocol https --local --persist --log-level debug
console.log(env)
{ ASSETS: Fetcher {}, TEST_DB: BetaDatabase {} }
Creation of the database is okay ./wrangler/state/d1/TEST_DB.sqlite3 but the only problem is the binding.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top Results From Across the Web
BUG: Unable to use D1 binding with local pages dev ... - GitHub
For Windows, wrangler@d1 seems to be broken entirely. If I run npx wrangler@d1 pages dev .\public\ I get the same out as the...
Read more >Gitlab Runner not able to resolve Gitlab URL - Kubernetes ...
I'm using microk8s and a gitlab self hosted (11.7.5) in local for development. Added hostAliases for gitlab-runner deployment to point to my ...
Read more >Fix list for Rational ClearCase - IBM
This document contains a complete listing of releases, refreshes, fix packs and interim fixes sorted by version for IBM® Rational ClearCase.
Read more >Verify errorcode = 20 : unable to get local issuer certificate
There is a bug entry for this OpenSSL problem, but nobody from the OpenSSL ... You can fetch it from Verisign's Use of...
Read more >Common HAProxy Errors - DigitalOcean
This tutorial series explains how to troubleshoot and fix some of the most common errors that you may encounter when using the HAProxy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This appears to be a bug in wrangler meaning the
--d1
flag doesn’t work correctly.It looks like you can only add D1 bindings in wrangler.toml. So to fix this right now you can add the following code to your
wrangler.toml
(obviously replacing the values that are relevant for your DB)You also then need to REMOVE the
--d1
flag you’re passing towrangler pages dev
and also add the--persist
flag`.However this is apparently a temporary workaround as wrangler.toml isn’t supposed to work with cloudlfare pages.
Fixed in https://github.com/cloudflare/wrangler2/pull/2265 Wrangler 2.4.4 - https://github.com/cloudflare/wrangler2/releases/tag/wrangler%402.4.4