-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
D1 bindings not present in Miniflare 3 #592
Comments
Hey! 👋 Could you try |
Just tried that and it is still not working. I'm still not sure why the Miniflare setup doesn't work since |
I see this behavior too. Here is what I'm using with the Miniflare 3 API index.js
Running with node v18.14.1
Perhaps we need to initialize the SQLite DB like in Wrangler dev? |
Hey! 👋 D1's implementation is split between an internal service and a JavaScript "shim" that exposes the D1 API and makes appropriate HTTP calls to the service. The internal service is bound to your worker as a service binding, and just provides a Previously, Miniflare 2 provided both the internal service and the shim for you when you specified With cloudflare/workerd#764, the shim has now been moved inside the runtime. This means we can remove the shim from Wrangler/Miniflare, and expose the internal service with the D1 API instead, without injecting anything into your user code. It's likely the reason you're seeing an empty object when logging the binding, is that This should all be fixed by #628, which should be landing soon. 👍 |
Tested the latest release and it works as intended. Thanks very much! |
I'm trying to use Miniflare 3 to run automated tests for my workers and I noticed workers using D1 does not have the database properly attached to the namespace.
In the env bindings I have a D1 database bound to
DB
and I can see the data is stored in.wrangler/state/v3/d1/[ID]
and accessible throughwrangler dev
but when running it through Miniflare the env bindingDB
is an empty object. Is D1 fully supported in Miniflare 3 already? Is there some other configuration I will need to provide? I can't find existing examples or documentation about how it should be used.Here's my configuration to run Miniflare
The text was updated successfully, but these errors were encountered: