Cloudflare D1 icon

Cloudflare D1

Query and manage Cloudflare D1 serverless SQL databases

Actions5

Overview

This node allows you to manage Cloudflare D1 serverless SQL databases, specifically focusing on database-level operations such as creating, listing, and deleting databases. The "Delete" operation under the "Database" resource enables you to delete an existing D1 database by specifying its name.

Common scenarios where this node is beneficial include automating database lifecycle management within Cloudflare's D1 environment, such as cleaning up unused databases or integrating database deletion into larger workflows that manage infrastructure resources.

Practical example: You have a workflow that provisions temporary databases for testing purposes. After tests complete, you use this node with the "Delete" operation to remove those temporary databases automatically, ensuring no leftover resources remain.

Properties

Name Meaning
Database Name The name of the D1 database to delete. This must match an existing database's name.

Output

The output JSON contains the result of the delete operation:

  • If successful, it returns the API response indicating success (usually an empty object or confirmation).
  • If unsuccessful, an error is thrown or returned depending on error handling settings.

Example output on success:

{
  "success": true
}

No binary data is produced by this operation.

Dependencies

  • Requires a valid Cloudflare API key credential with permissions to manage D1 databases.
  • Needs the account ID associated with the Cloudflare API key.
  • The node makes HTTP requests to the Cloudflare API endpoint https://api.cloudflare.com/client/v4.
  • Proper n8n credentials setup for Cloudflare API access is necessary.

Troubleshooting

  • Database Not Found Error: If the specified database name does not exist, the node throws an error stating "Database "<name>" not found". Ensure the database name is correct and exists in your Cloudflare account.
  • Authentication Errors: If the API token or account ID is invalid or lacks required permissions, authentication errors will occur. Verify your API credentials and their scopes.
  • API Rate Limits or Network Issues: Requests may fail due to rate limiting or connectivity problems. Implement retry logic or check network status.
  • Invalid Input: Providing an empty or malformed database name will cause errors. Always provide a valid, non-empty string.

To resolve errors, verify input parameters, ensure credentials are correctly configured, and confirm the target database exists before attempting deletion.

Links and References

Discussion