Skip to content

Commit 29747a8

Browse files
authored
Fix frameworks deploy to preview channel (#6025)
1 parent a9b6ecf commit 29747a8

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/deploy/hosting/prepare.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as utils from "../../utils";
1212
import { HostingSource, RunRewrite } from "../../firebaseConfig";
1313
import * as backend from "../functions/backend";
1414
import { ensureTargeted } from "../../functions/ensureTargeted";
15+
import { generateSSRCodebaseId } from "../../frameworks";
1516

1617
function handlePublicDirectoryFlag(options: HostingOptions & Options): void {
1718
// Allow the public directory to be overridden by the --public flag
@@ -74,6 +75,12 @@ export async function addPinnedFunctionsToOnlyString(
7475
]?.[r.function.functionId];
7576
if (endpoint) {
7677
options.only = ensureTargeted(options.only, endpoint.codebase || "default", endpoint.id);
78+
} else if (c.webFramework) {
79+
options.only = ensureTargeted(
80+
options.only,
81+
generateSSRCodebaseId(c.site),
82+
r.function.functionId
83+
);
7784
} else {
7885
// This endpoint is just being added in this push. We don't know what codebase it is.
7986
options.only = ensureTargeted(options.only, r.function.functionId);

src/frameworks/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ function memoizeBuild(
104104
return value;
105105
}
106106

107+
/**
108+
* Use a function to ensure the same codebase name is used here and
109+
* during hosting deploy.
110+
*/
111+
export function generateSSRCodebaseId(site: string) {
112+
return `firebase-frameworks-${site}`;
113+
}
114+
107115
/**
108116
*
109117
*/
@@ -330,7 +338,7 @@ export async function prepareFrameworks(
330338
);
331339
}
332340

333-
const codebase = `firebase-frameworks-${site}`;
341+
const codebase = generateSSRCodebaseId(site);
334342
const existingFunctionsConfig = options.config.get("functions")
335343
? [].concat(options.config.get("functions"))
336344
: [];

0 commit comments

Comments
 (0)