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

Fix frameworks deploy to preview channel #6025

Merged
merged 4 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions src/deploy/hosting/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion src/frameworks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

/**
*
*/
Expand Down Expand Up @@ -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"))
: [];
Expand Down