Registry / devops / netlify-purge-cloudflare-on-deploy

netlify-purge-cloudflare-on-deploy

JSON →
library1.2.0jsnpmunverified

Netlify build plugin that automatically purges the Cloudflare cache for your zone upon each deploy. Version 1.2.0 is the latest stable release. It supports two authentication methods: API Token (recommended, with granular permissions) and Legacy API Key (full account access). The cache purge is triggered before the deploy but after the build, which is the only timing Netlify allows. The plugin is maintained by a community contributor and is available on npm. It requires environment variables for Cloudflare credentials and zone ID.

npm install netlify-purge-cloudflare-on-deploy
INSTALL
IMPORT
SIG · NETLIFY-PURGE-CLOU
N
netlify-purge-cloudflare-on-deploy
devopsjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
No import needed; the plugin is configured via netlify.toml
const purge = require('netlify-purge-cloudflare-on-deploy')
This is a Netlify build plugin, not a standard Node.js library. It is loaded automatically when added to the [[plugins]] array in netlify.toml.

Shows how to configure the plugin in netlify.toml and required environment variables.

# In netlify.toml: [[plugins]] package = "netlify-purge-cloudflare-on-deploy" # Set environment variables in Netlify UI or CLI: # CLOUDFLARE_ZONE_ID=your-zone-id # CLOUDFLARE_API_TOKEN=your-api-token # OR (legacy) # CLOUDFLARE_EMAIL=your-email # CLOUDFLARE_API_KEY=your-api-key
Debug
Known issues
gotchaCache purging occurs before deploy, not after. Netlify only supports triggering plugins before deploy.
fix
Ensure your cache is not serving stale content for a short window until the deploy completes.
affects: >=1.0.0
deprecatedAPI Key authentication (CLOUDFLARE_EMAIL + CLOUDFLARE_API_KEY) is legacy and provides full account access. API Token is recommended.
fix
Switch to using CLOUDFLARE_API_TOKEN instead of CLOUDFLARE_API_KEY and CLOUDFLARE_EMAIL.
affects: >=1.0.0
gotchaIf both API Token and API Key environment variables are set, the plugin defaults to API Token. This may cause unexpected behavior if you intend to use the key.
fix
Remove the unused set of environment variables to avoid confusion.
affects: >=1.0.0
deprecatedCLOUDFLARE_EMAIL environment variable is only used with API Key authentication. It is ignored when using API Token.
fix
Do not set CLOUDFLARE_EMAIL if using API Token.
affects: >=1.0.0
Errors
Common errors & fixes
Build failure with 'Bad request'
Incorrect or missing Cloudflare credentials or zone ID in environment variables.
fix
Verify CLOUDFLARE_ZONE_ID and either CLOUDFLARE_API_TOKEN (recommended) or CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL are set correctly in Netlify environment variables.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
netlify-purge-cloudflare-on-deploy — npm install netlify-purge-cloudflare-on-deploy · libregistry