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

Point v2 function target to entryPoint #6698

Merged
merged 3 commits into from
Jan 24, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Point v2 function target to entrypoint. (#6698)
- Fixed issue where Auth emulator sign in with Google only shows default tenant. (#6683)
- Prevent the use of pinTags + minInstances on the same function, as the features are not mutually compatible (#6684)
- Added force flag to delete backend (#6635).
Expand Down
6 changes: 2 additions & 4 deletions src/gcp/cloudfunctionsv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@
* @param type Type of deployment - create, update, or delete.
* @param err The error returned from the operation.
*/
function functionsOpLogReject(func: InputCloudFunction, type: string, err: any): void {

Check warning on line 251 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (err?.message?.includes("maxScale may not exceed")) {

Check warning on line 252 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value

Check warning on line 252 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value
const maxInstances = func.serviceConfig.maxInstanceCount || DEFAULT_MAX_INSTANCE_COUNT;
utils.logLabeledWarning(
"functions",
Expand All @@ -265,14 +265,14 @@
`You can adjust the max instances value in your function's runtime options:\n\t${suggestedFix}`
);
} else {
utils.logLabeledWarning("functions", `${err?.message}`);

Check warning on line 268 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression

Check warning on line 268 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value
if (err?.context?.response?.statusCode === 429) {

Check warning on line 269 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .context on an `any` value
utils.logLabeledWarning(
"functions",
`Got "Quota Exceeded" error while trying to ${type} ${func.name}. Waiting to retry...`
);
} else if (
err?.message?.includes(

Check warning on line 275 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value

Check warning on line 275 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe call of an `any` typed value
"If you recently started to use Eventarc, it may take a few minutes before all necessary permissions are propagated to the Service Agent"
)
) {
Expand All @@ -288,8 +288,8 @@
);
}
throw new FirebaseError(`Failed to ${type} function ${func.name}`, {
original: err,

Check warning on line 291 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
status: err?.context?.response?.statusCode,

Check warning on line 292 in src/gcp/cloudfunctionsv2.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
context: { function: func.name },
});
}
Expand Down Expand Up @@ -331,7 +331,7 @@

cloudFunction.serviceConfig.environmentVariables = {
...cloudFunction.serviceConfig.environmentVariables,
FUNCTION_TARGET: functionId.replaceAll("-", "."),
FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."),
};

try {
Expand Down Expand Up @@ -418,8 +418,6 @@
* Customers can force a field to be deleted by setting that field to `undefined`
*/
export async function updateFunction(cloudFunction: InputCloudFunction): Promise<Operation> {
const components = cloudFunction.name.split("/");
const functionId = components.splice(-1, 1)[0];
// Keys in labels and environmentVariables and secretEnvironmentVariables are user defined, so we don't recurse
// for field masks.
const fieldMasks = proto.fieldMasks(
Expand All @@ -439,7 +437,7 @@

cloudFunction.serviceConfig.environmentVariables = {
...cloudFunction.serviceConfig.environmentVariables,
FUNCTION_TARGET: functionId.replaceAll("-", "."),
FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."),
};

try {
Expand Down