Repository navigation
Load server plugins from the deployment bucket at runtime - #53
Merged
Merged
Conversation
A plugin that provides only server operations can be bundled into one record (scripts/bundle-plugin.ts) and published to plugins/<name>.json in an optional PLUGINS R2 bucket. The host picks it up within seconds without a rebuild and runs it in its own isolate through the existing Worker loader, with the same dispatcher, schemas and error rules as build-time plugins. Published plugins can only read PLUGIN_* deployment variables.
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today, adding or changing a deployment plugin means rebuilding and redeploying Artifacts. This lets a server-only plugin be published into a running deployment instead.
scripts/bundle-plugin.ts <plugin.ts> --out <file>turns adefinePlugin(...)module into one JSON record. The record holds the plugin's metadata and schemas, plus one bundled module containing its handlers, their dependencies, the shared dispatcher and standalone Ajv validators.celld r2 put artifacts-plugins plugins/<name>.json …orwrangler r2 object put …to an optionalPLUGINSR2 binding. Without the binding nothing changes.LOADER. The isolate'senvholds only the record's declared secrets.createPluginDispatcheras build-time plugins (moved tosrc/plugins/dispatch.ts), so schemas,authorize, timeouts, size limits and error messages match.plugins_list,artifact_plugin_call,pluginCalland the gallery route all work unchanged.PLUGIN_*variables. Write access to the bucket can't readBETTER_AUTH_SECRET, provider credentials or fleet tokens.Tests:
cloudflare/runtime-plugins.test.ts(Miniflare): listing, a call's identity and secret isolation, the full error matrix (including corrupt records and a record asking for a host variable), and republishing without a host deploy.cloudflare/runtime-plugins-celld.test.ts: the same path end to end on celld 0.6.1. Added totest:celld.typecheck,test,test:cloudflareandtypecheck:cloudflarepass.