Skip to main content

Forwarding version

The upstreamResourceVersion field selects which function version receives the traffic of a route.

v3.8.10+

upstreamResourceVersion has been available since v3.8.10; it applies to SCF and WEB_SCF routes and is ignored by other upstream types.

Values​

ValueMeaning
A version number (1, 2, …)Forward to that version, which must already be published
$LATESTForward to the latest version, following new releases automatically
$DEFAULTForward to the resource, traffic split decided by the resource-side version configuration; the default when omitted

Per-command behaviour​

CommandBehaviour
tcb routes add without the fieldThe server treats it as $DEFAULT
tcb routes edit without the fieldKeeps the current binding
tcb routes edit with $DEFAULTClears the binding and restores resource-side traffic control
tcb routes listThe upstream version column shows the current binding, - when unbound; --json exposes upstreamResourceVersion

⚠️ The domain precheck VerifyHTTPServiceRoute does not recognise this field and the CLI strips it before the precheck. The precheck only covers domain ownership, quota, and path conflicts; an invalid version surfaces as an error from the create or update API.

Usage​

The version must be a published function version. Publish with tcb fn publish-version; deployment commands only move $LATEST and do not create version numbers.

The binding applies to the whole route and supports no weights. For proportional traffic use $DEFAULT and configure alias traffic on the function side.

# Give the new version its own route, then switch the main route
tcb routes add -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/func-canary","upstreamResourceType":"SCF","upstreamResourceName":"my-function","upstreamResourceVersion":"3"}]}'

tcb routes edit -e <envId> --data '{"domain":"api.example.com","routes":[{"path":"/func","upstreamResourceVersion":"3"}]}'