Forwarding version
The upstreamResourceVersion field selects which function version receives the traffic of a route.
upstreamResourceVersion has been available since v3.8.10; it applies to SCF and WEB_SCF routes and is ignored by other upstream types.
Values
| Value | Meaning |
|---|---|
A version number (1, 2, …) | Forward to that version, which must already be published |
$LATEST | Forward to the latest version, following new releases automatically |
$DEFAULT | Forward to the resource, traffic split decided by the resource-side version configuration; the default when omitted |
Per-command behaviour
| Command | Behaviour |
|---|---|
tcb routes add without the field | The server treats it as $DEFAULT |
tcb routes edit without the field | Keeps the current binding |
tcb routes edit with $DEFAULT | Clears the binding and restores resource-side traffic control |
tcb routes list | The upstream version column shows the current binding, - when unbound; --json exposes upstreamResourceVersion |
⚠️ The domain precheck
VerifyHTTPServiceRoutedoes 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"}]}'