fix: strip unresolved placeholders on deploy instead of throwing - #1436
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1436 +/- ##
==========================================
+ Coverage 80.23% 80.35% +0.11%
==========================================
Files 163 163
Lines 7559 7568 +9
Branches 1668 1670 +2
==========================================
+ Hits 6065 6081 +16
+ Misses 801 794 -7
Partials 693 693 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| `To use this value, define ${path | ||
| .split('.') | ||
| .pop() | ||
| ?.toUpperCase()} in AUTH0_KEYWORD_REPLACE_MAPPINGS. The existing value on Auth0 will be preserved.` |
There was a problem hiding this comment.
I think the suggested key here might be slightly off. It's derived from the field name rather than the placeholder itself. For options.client_secret: ##CONNECTIONS_WAAD_SECRET##, it would tell the user to define CLIENT_SECRET, but the value they actually need to map is CONNECTIONS_WAAD_SECRET, so following the message as-is wouldn't quite work. Could we maybe pull the name from value instead (stripping the ##/@@)?
It's already available right there in the loop, so it might be a small change.
There was a problem hiding this comment.
Addressed and updated
🔧 Changes
Previously, deploying a resource with an unresolved
##...##or@@...@@placeholder would throw an error and abort the deploy. This caused the export→import round-trip to fail for connections and other resources where the CLI auto-generates secret placeholders on export (e.g.##CONNECTIONS_WAAD_SECRET##), since Auth0 does not expose the actual secret value, making it impossible for users to provide the keyword mapping.Change: Instead of throwing, unresolved placeholders are now stripped from the payload before the API call, with a warn log per field. Auth0 preserves its existing value for any stripped field.
stripUnresolvedPlaceholdersutility insrc/tools/utils.tsAPIHandler.processChanges(create, update, conflict paths) now callsstripUnresolvedPlaceholdersin place ofvalidateNoUnresolvedPlaceholders📚 References
🔬 Testing
test/tools/utils.test.jsandtest/tools/auth0/handlers/default.tests.ts##CONNECTIONS_WAAD_SECRET##), ran import without defining the mapping, field was stripped with a warning and the connection updated successfully📝 Checklist