diff --git a/src/deploy/hosting/prepare.ts b/src/deploy/hosting/prepare.ts index 0a6223c39bf..5cff13ae002 100644 --- a/src/deploy/hosting/prepare.ts +++ b/src/deploy/hosting/prepare.ts @@ -12,6 +12,7 @@ import * as utils from "../../utils"; import { HostingSource, RunRewrite } from "../../firebaseConfig"; import * as backend from "../functions/backend"; import { ensureTargeted } from "../../functions/ensureTargeted"; +import { generateSSRCodebaseId } from "../../frameworks"; function handlePublicDirectoryFlag(options: HostingOptions & Options): void { // Allow the public directory to be overridden by the --public flag @@ -74,6 +75,12 @@ export async function addPinnedFunctionsToOnlyString( ]?.[r.function.functionId]; if (endpoint) { options.only = ensureTargeted(options.only, endpoint.codebase || "default", endpoint.id); + } else if (c.webFramework) { + options.only = ensureTargeted( + options.only, + generateSSRCodebaseId(c.site), + r.function.functionId + ); } else { // This endpoint is just being added in this push. We don't know what codebase it is. options.only = ensureTargeted(options.only, r.function.functionId); diff --git a/src/frameworks/index.ts b/src/frameworks/index.ts index 8ac1b3bf9c8..b25bc4f49b3 100644 --- a/src/frameworks/index.ts +++ b/src/frameworks/index.ts @@ -104,6 +104,14 @@ function memoizeBuild( return value; } +/** + * Use a function to ensure the same codebase name is used here and + * during hosting deploy. + */ +export function generateSSRCodebaseId(site: string) { + return `firebase-frameworks-${site}`; +} + /** * */ @@ -330,7 +338,7 @@ export async function prepareFrameworks( ); } - const codebase = `firebase-frameworks-${site}`; + const codebase = generateSSRCodebaseId(site); const existingFunctionsConfig = options.config.get("functions") ? [].concat(options.config.get("functions")) : [];