| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This pull request updates the GET_PROJECT_CONFIG and UPDATE_PROJECT_CONFIG response validators in src/auth/auth-api-request.ts to skip the name field assertion when running against the Auth emulator. Additionally, it adds comprehensive unit tests in test/unit/auth/auth-api-request.spec.ts to verify the behavior of getProjectConfig and updateProjectConfig under both standard and emulator environments. I have no feedback to provide.
Sorry, something went wrong.
…lator The Auth emulator does not populate the resource `name` field on its /config responses, so getProjectConfig() and updateProjectConfig() throw "INTERNAL ASSERT FAILED: Unable to get/update project config" against the emulator. Skip the assertion in both validators when useEmulator() is true. Production behavior is unchanged — a backend response missing `name` still throws. The guard reuses the existing useEmulator() helper, matching the same dynamic-read pattern AuthResourceUrlBuilder and AuthHttpClient already use to branch on the emulator. Fixes firebase#2461.
There was a problem hiding this comment.
Thank you for your contribution! LGTM!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Closes #2461.
Thanks @nerder and @mexican-jack for the same-symptom reports on updateProjectConfig and password policy updates — both go through the endpoints touched here.
Summary
getProjectConfig() and updateProjectConfig() throw INTERNAL ASSERT FAILED: Unable to get/update project config when the Auth emulator is running. The emulator doesn't populate the resource name field on /config responses, and both endpoint validators require name to be a non-empty string.
This PR skips that assertion when useEmulator() is true so the call succeeds against the emulator. Production behavior is unchanged.
Behavior change
The Identity Toolkit projects.getConfig / projects.updateConfig REST contract treats name as an output-only resource name that production always populates — the emulator just doesn't implement it.
Scope
The guard is limited to GET_PROJECT_CONFIG and UPDATE_PROJECT_CONFIG because those are the two endpoints with reproductions in the issue and its comments. Other validators in the same file (GET_TENANT, UPDATE_TENANT, OIDC/SAML config) follow the same pattern but have no emulator reports — leaving them out keeps the diff narrow.
Password policy updates (raised by @mexican-jack) go through updateProjectConfig internally, so this PR covers that case as well.
Implementation notes
The guard uses the existing useEmulator() helper at src/auth/auth-api-request.ts:2321 — the same one AuthResourceUrlBuilder (line 134), TenantAwareAuthResourceUrlBuilder (line 200), and AuthHttpClient (line 232) use to branch on the emulator. Same dynamic-read pattern as the rest of main.
Relationship to #3080
#3080 is open in the same area and captures the emulator host at init time instead of reading it on each call. This PR uses the dynamic useEmulator() read because that's what main does today. If #3080 lands first, I'll rebase and switch the validator guard to the captured value so the emulator semantics stay aligned.
Test coverage
test/unit/auth/auth-api-request.spec.ts adds a getProjectConfig and an updateProjectConfig describe block under the supportsTenantManagement branch. Each has three cases:
afterEach clears FIREBASE_AUTH_EMULATOR_HOST so emulator state doesn't bleed into other specs.
Verification
Diff: 2 files changed, +136 insertions, -1 deletion (10 LOC in src, the rest in test).