Skip to content

Resolve Proxy-backed addresses in configuration property traversal#402

Merged
GrahamCampbell merged 1 commit into
4.xfrom
resolve-proxy-backed-configuration-addresses
Jun 12, 2026
Merged

Resolve Proxy-backed addresses in configuration property traversal#402
GrahamCampbell merged 1 commit into
4.xfrom
resolve-proxy-backed-configuration-addresses

Conversation

@GrahamCampbell

Copy link
Copy Markdown
Contributor

This extends the proxy-aware address resolution from #396 to the other ways a value can be addressed once it has been embedded into the configuration. Until now a Proxy-backed object returned by a JS file resolved virtual properties through a file(...) address, but the same value reached through a ${self:...} reference, through the resolveConfigurationProperty util handed to resolver functions and plugin sources, or through serverless print --path, was traversed by own properties only and silently came up empty. All of these paths now follow the same rules: own properties are always followed, Proxy-backed values are followed through their get handler, and proto, prototype and constructor are never followed through a proxy unless claimed as own.

The dependency traversal in the variables resolver and a new getReachableByPath helper used by the print command both build on the canFollowProperty helper introduced in #400, so the rule continues to live in one place. As in #400, a property access that throws during dependency traversal now surfaces as a coded ServerlessError naming the configuration path rather than escaping as a raw exception. The existing getOwnByPath helper is left untouched since its own-only semantics are still what the 3.x print command relies on, and write paths in the resolver intentionally remain own-property-only so that resolution never invokes a proxy's set handler. The variables guide is updated accordingly, replacing the sentence from #399 that described this behaviour as specific to file addresses.

This is deliberately a 4.x-only change: configurations that previously fell back to a default because a proxy-served property could not be found will now resolve the actual value, which is the sort of behaviour shift we would rather not ship to the stable branch.

@GrahamCampbell GrahamCampbell merged commit 68386f6 into 4.x Jun 12, 2026
8 checks passed
@GrahamCampbell GrahamCampbell deleted the resolve-proxy-backed-configuration-addresses branch June 12, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant