Related issues
[REQUIRED] Version Info
node: v20.7.0
firebase-functions: v4.5.0
firebase-admin: v11.11.1
[REQUIRED] Test case
Provided below.
[REQUIRED] Steps to reproduce
When env variable used as shown in Google Docs it doesn't compile with CallableOptions, however the same param is used without issues with HttpsOptions. CallableOptions extends HttpsOptions, so it should have the same behavior as HttpsOptions.
my_function.ts
import {defineBoolean} from "firebase-functions/params";
import {onCall} from "firebase-functions/v2/https";
const enforceAppCheck = defineBoolean("ENFORCE_APP_CHECK");
export const myFunction = onCall({
enforceAppCheck: enforceAppCheck,
}, async (request) => {
});
.env
[REQUIRED] Expected behavior
env variable should be assignable without compile errors.
[REQUIRED] Actual behavior
Type 'BooleanParam' is not assignable to type 'boolean | undefined'.ts(2322)
https.d.ts(111, 5): The expected type comes from property 'enforceAppCheck' which is declared here on type 'CallableOptions'
Were you able to successfully deploy your functions?
Function doesn't deploy due to compile issues.
FIX
To fix the issue we need to update the code below:
export interface CallableOptions extends HttpsOptions {
enforceAppCheck?: boolean;
consumeAppCheckToken?: boolean;
}
to this code:
export interface CallableOptions extends HttpsOptions {
enforceAppCheck?: boolean | Expression<boolean>;
consumeAppCheckToken?: boolean | Expression<boolean>;
}
Related issues
[REQUIRED] Version Info
node: v20.7.0
firebase-functions: v4.5.0
firebase-admin: v11.11.1
[REQUIRED] Test case
Provided below.
[REQUIRED] Steps to reproduce
When env variable used as shown in Google Docs it doesn't compile with
CallableOptions, however the same param is used without issues withHttpsOptions.CallableOptionsextendsHttpsOptions, so it should have the same behavior asHttpsOptions.my_function.ts
.env
[REQUIRED] Expected behavior
env variable should be assignable without compile errors.
[REQUIRED] Actual behavior
Type 'BooleanParam' is not assignable to type 'boolean | undefined'.ts(2322)
https.d.ts(111, 5): The expected type comes from property 'enforceAppCheck' which is declared here on type 'CallableOptions'
Were you able to successfully deploy your functions?
Function doesn't deploy due to compile issues.
FIX
To fix the issue we need to update the code below:
to this code: