🔥 Fully-local simulator for Cloudflare Workers. For the latest version, see https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare.
NODE_EXTRA_CA_CERTS
(https://github.com/cloudflare/miniflare/pull/587)Miniflare v3 now uses workerd
, the open-source Cloudflare Workers runtime. This is the same runtime that's deployed on Cloudflare’s network, giving bug-for-bug compatibility and practically eliminating behavior mismatches. Refer to the Miniflare v3 and Wrangler v3 announcements for more information.
Several features from Miniflare v2 are not supported in Miniflare v3's initial release. However, they are on the roadmap, and will be added back soon:
/.mf/scheduled
or /cdn-cgi/mf/scheduled
(manually triggering events is supported via the --test-scheduled
Wrangler flag and visiting /__scheduled
)fetch()
requestsget{Bindings,KVNamespace,R2Bucket,Caches,DurableObjectNamespace}()
methodsMiniflare v3 no longer includes a standalone CLI. To get the same functionality, you will need to switch over to Wrangler. Wrangler v3 uses Miniflare v3 by default. To start a local development server, run:
$ npx wrangler@3 dev
If there are features from the Miniflare CLI you would like to see in Wrangler, please open an issue on GitHub.
We have tried to keep Miniflare v3's API close to Miniflare v2 where possible, but many options and methods have been removed or changed with the switch to the open-source workerd
runtime. See the 📚 GitHub README
for the new API docs, and the ⬆️ Migration Guide for the full list of removals and changes.
ETag
s (#575)wrangler dev
(#570)upstream
s (#568)Miniflare
instances in different processes/worker-threads to start in parallel with port: 0
(#575)node:
and cloudflare:
modules to be used with modules: true
option (#569)Ed25519
algorithm and mark X448
/Ed448
algorithms as unsupported. Thanks @panva for jose
's comprehensive test suite.ExecutionContext
as a global value to Miniflare's unit testing environments' global types. Miniflare injects the ExecutionContext
class into testing environments, so they can be constructed and passed to imported module event handlers. This change ensures new ExecutionContext()
isn't a type error.wrangler.toml
build.watch_dir
to be an array of directories. Thanks @sj-e2digital for the PR.Miniflare#reload()
with queue consumers set. Closes issue #560, thanks @calebmer.@miniflare/core
as a dependency of @miniflare/r2
. Closes issue #559, thanks @calebmer.@miniflare/d1
README
with new APIR2Bucket#delete()
Range
header in R2Bucket#get()
R2Bucket#list()
startAfter
optionsha*
checksums in R2Bucket#put()
and return from R2Bucket#{get,head}
R2Bucket#put()
secondsGranularity
option in R2Conditional
scustomMetadata
size to R2Bucket#put()
range
information from R2Bucket#head()
DurableObjectNamespace#jurisdiction()
method. Note the passed jurisdiction
is validated but otherwise ignored. IDs generated by sub-namespaces in different jurisdictions will be the same. Thanks @DaniFoldi for the PR.crypto.subtle.timingSafeEqual()
function. Thanks @DaniFoldi for the PR.experimental
compatibility flag alongside nodejs_compat
to use node:assert
, node:buffer
and node:util
modules. Closes issue #547, thanks @Skye-31 and @DaniFoldi for the PR.?N
parameters in D1 prepared statements. Closes issues #504, #526, cloudflare/workers-sdk#2811 and cloudflare/workers-sdk#2887. Thanks @ruslantalpa and @maurerbot.Response
s constructed with byte streams. Notably, byte streams are returned from lots of Workers runtime APIs (e.g. KV, R2) to support BYOB reads. Closes issue #527, thanks @cwkang1998.Content-Length
from Request
/Response
body
streams when constructing a new Request
/Response
or calling fetch
. Closes issue #522, thanks @notorca.Add support for D1 via the d1Databases
option (#519)
Note instead of providing a D1Database
binding with the database name like Miniflare 2, we now provide a regular Fetcher
service binding like the real runtime.
Add support for the durableObjectsPersist
option (#517)
Log cause
s of errors returned with the MF-Experimental-Error-Stack
header (#519)
Propagate errors returned with the MF-Experimental-Error-Stack
header through dispatchFetch()
(assuming the Accept
header prevents the text/html
-typed pretty-error page being returned) (#519)
MF-Custom-Service
header from request
s to custom service bindings, closes #475 (#515)workerd
to Miniflare, closes #476 (#515)Miniflare#dispatchFetch()
and custom service binding fetch()
, closes #488 (#515)better-sqlite3
to 8.1.0
allowing installation on Node 19, closes #518 (#521)undici
to 5.20.0
, addressing GHSA-5r9g-qh6m-jxff and GHSA-r6ch-mqf9-qc9w. Thanks @WalshyDev and @Cherry for the PR.R2MultipartUpload
instead of a Promise<R2MultipartUpload>
from R2Bucket#resumeMultipartUpload()
. Thanks @notorca for the PR.FixedLengthStream
s and Request
/Response
body
streams when calling ReadableStream#tee()
. Closes issue #506, thanks @notorca.