Repository navigation
fix(#977): reserve /admin/data-privacy backend route (AdminService was swallowing it) - #3147
Merged
Merged
Conversation
…OData adapter does not swallow it
DataPrivacyService is defined at @(path:'/admin/data-privacy'). AdminService's
OData adapter mounts at /admin and intercepts the nested /admin/data-privacy/*
path first, returning "Invalid resource path AdminService.data-privacy" (404).
This mirrors the existing AnalyticsService (/admin/analytics) late-bound
reservation in srv/server.js: declare a stub router, reserve the longer
/admin/data-privacy/* prefix in the bootstrap/pre-serve block BEFORE CAP mounts
AdminService, then wire the stub to the real DataPrivacyService OData adapter in
the cds.on('served') handler (wrapped with the same context + auth middlewares).
The approuter route added in #3142 was necessary but not sufficient on its own:
the backend still needs this reservation or the request never reaches
DataPrivacyService.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DataPrivacyService(/admin/data-privacy) 404s withInvalid resource path AdminService.data-privacy.DataPrivacyServiceis defined at@(path:'/admin/data-privacy'), butAdminService's OData adapter mounts at/adminand intercepts the nested/admin/data-privacy/*path first.The approuter route added in #3142 was necessary but not sufficient — the backend still needs a late-bound router reservation or the request never reaches
DataPrivacyService.Fix
Single-file change to
srv/server.js, mirroring the existingAnalyticsService(/admin/analytics) late-bound reservation exactly:dataPrivacyOdataRouter(503 during boot)./admin/data-privacy/*in the same bootstrap/pre-serve block that reserves/admin/analytics, BEFORE CAP mountsAdminService, so express routes the longer prefix to the stub first.DataPrivacyServiceOData adapter in thecds.on('served')handler, wrapped with the samecontextMw+authMwmiddlewares, with the same CDS-9/CDS-10 adapter-shape handling.No
.cdsor approuter/xs-app.jsonchanges.Verification
npx cds build --productionexits 0.test/unit/data-privacy-export.test.js+test/unit/data-privacy-service-metadata.test.jspass (13 tests). (Unit tests run the service in-process and do not exercise server.js routing; they confirm no regression.)