Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a custom path in Firebase functions custom domain #8441

Merged
merged 4 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dull-nails-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/functions': patch
---

Allow a custom path in Firebase functions custom domain
5 changes: 5 additions & 0 deletions packages/functions/src/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ describe('Firebase Functions > Service', () => {
assert.equal(service._url('foo'), 'https://mydomain.com/foo');
});

it('correctly sets custom domain with path', () => {
service = createTestService(app, 'https://mydomain.com/functions');
assert.equal(service._url('foo'), 'https://mydomain.com/functions/foo');
});

it('prefers emulator to custom domain', () => {
const service = createTestService(app, 'https://mydomain.com');
connectFunctionsEmulator(service, 'localhost', 5005);
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class FunctionsService implements _FirebaseService {
// Resolve the region or custom domain overload by attempting to parse it.
try {
const url = new URL(regionOrCustomDomain);
this.customDomain = url.origin;
this.customDomain = url.origin + url.pathname;
segevfiner marked this conversation as resolved.
Show resolved Hide resolved
this.region = DEFAULT_REGION;
} catch (e) {
this.customDomain = null;
Expand Down
Loading