Skip to main content

workers_versions

Creates, updates, deletes, gets or lists a workers_versions resource.

Overview

Nameworkers_versions
TypeResource
Idcloudflare.workers.workers_versions

Fields

The following fields are returned by SELECT queries:

Get version success.

NameDatatypeDescription
idstring (uuid)Version identifier.
annotationsobjectMetadata about the version.
assetsobjectConfiguration for assets within a Worker. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain.
bindingsarrayList of bindings attached to a Worker. You can find more about bindings on our docs: https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/#bindings.
compatibility_datestringDate indicating targeted support in the Workers runtime. Backwards incompatible fixes to the runtime following this date will not affect this Worker. (example: 2021-01-01)
compatibility_flagsarrayFlags that enable or disable certain features in the Workers runtime. Used to enable upcoming features or opt in or out of specific changes not included in a compatibility_date. (x-stainless-collection-type: set)
containersarrayList of containers attached to a Worker. Containers can only be attached to Durable Object classes of this Worker script. (x-stainless-collection-type: set)
created_onstring (date-time)When the version was created.
limitsobjectResource limits enforced at runtime. (x-stainless-terraform-configurability: computed_optional)
main_modulestringThe name of the main module in the modules array (e.g. the name of the module that exports a fetch handler). (example: index.js)
migration_tagstringDurable Object migration tag. Set when the version is deployed. Omitted if the version has not been deployed or the Worker does not use Durable Objects. (example: v1)
migrationsobjectMigrations for Durable Objects associated with the version. Migrations are applied when the version is deployed.
modulesarrayCode, sourcemaps, and other content used at runtime. This includes _headers and _redirects files used to configure Static Assets. _headers and _redirects files should be included as modules named _headers and _redirects with content type text/plain. (x-stainless-collection-type: set)
numberintegerThe integer version number, starting from one.
placementobjectConfiguration for Smart Placement. Specify mode='smart' for Smart Placement, or one of region/hostname/host.
sourcestringThe client used to create the version. (example: wrangler)
startup_time_msintegerTime in milliseconds spent on Worker startup.
urlsarrayAll routable URLs that always point to this version. Does not include alias URLs, since aliases can be updated to point to a different version.
usage_modelstringUsage model for the version. (standard, bundled, unbound) (default: standard, example: standard)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_accountselectaccount_id, worker_id, version_idincludeGet details about a specific version.
list_by_accountselectaccount_id, worker_idpage, per_pageList all versions for a Worker.
create_by_accountinsertaccount_id, worker_iddeployCreate a new version.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
version_idstring
worker_idstring
deployboolean
includestring
pageintegerCurrent page.
per_pageintegerItems per-page.

SELECT examples

Get details about a specific version.

SELECT
id,
annotations,
assets,
bindings,
compatibility_date,
compatibility_flags,
containers,
created_on,
limits,
main_module,
migration_tag,
migrations,
modules,
number,
placement,
source,
startup_time_ms,
urls,
usage_model
FROM cloudflare.workers.workers_versions
WHERE account_id = '{{ account_id }}' -- required
AND worker_id = '{{ worker_id }}' -- required
AND version_id = '{{ version_id }}' -- required
AND include = '{{ include }}'
;

INSERT examples

Create a new version.

INSERT INTO cloudflare.workers.workers_versions (
annotations,
assets,
bindings,
compatibility_date,
compatibility_flags,
containers,
limits,
main_module,
migrations,
modules,
placement,
usage_model,
account_id,
worker_id,
deploy
)
SELECT
'{{ annotations }}',
'{{ assets }}',
'{{ bindings }}',
'{{ compatibility_date }}',
'{{ compatibility_flags }}',
'{{ containers }}',
'{{ limits }}',
'{{ main_module }}',
'{{ migrations }}',
'{{ modules }}',
'{{ placement }}',
'{{ usage_model }}',
'{{ account_id }}',
'{{ worker_id }}',
'{{ deploy }}'
RETURNING
errors,
messages,
result,
success
;