Firebase Functions lib update fails on TS compile
See original GitHub issueRelated issues
I couldn’t find any directly related issues.
[REQUIRED] Version info
node:
In package.json
it’s Node engine 16
Node CLI in Path is 16.16.0
NPM in Path is 8.19.1
firebase-functions:
In package.json
it’s ^4.0.1
firebase-tools:
In package.json
it’s ^11.14.4
Firebase CLI in Path is 11.7.0
firebase-admin:
In package.json
it’s ^10.3.0
(upgrading this also fails with similar errors as below)
Test case
I have a Firebase Functions project that works and is deployed through GH Actions each week.
GH Dependabot tried to bump 7-8 dependencies last week, but some of those changes failed:
- Bump axios from 0.27.2 to 1.1.2 in /functions
- I don’t have to update this one. It doesn’t matter to me (unless it matters for Firebase libs)
- Bump firebase-admin from 10.3.0 to 11.2.0 in /functions
- Bump firebase-functions from 3.24.1 to 4.0.1 in /functions
This problem is reproducible both locally and on CI.
Steps to reproduce
Create a Firebase project to deploy Firebase Functions.
Here’s my config:
package.json
{
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"main": "lib/index.js",
"dependencies": {
"axios": "^0.27.2",
"cors": "^2.8.5",
"express": "^4.18.2",
"firebase": "^9.10.0",
"firebase-admin": "^10.3.0",
"firebase-functions": "^4.0.1",
"firebase-tools": "^11.14.4",
"telegraf": "^4.10.0",
"typescript": "^3.9.10"
},
"devDependencies": {
"@types/cors": "^2.8.10",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"eslint": "^7.32.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.2.0",
"typescript": "^3.9.10"
},
"private": true
}
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2020",
"moduleResolution": "node"
},
"compileOnSave": true,
"include": [
"src"
]
}
firebase.json
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
],
"source": "functions"
},
"emulators": {
"functions": {
"port": 5001
},
"database": {
"port": 9000
},
"pubsub": {
"port": 8085
},
"ui": {
"enabled": true
}
}
}
Expected behavior
Well, I think upgrading Firebase dependencies shouldn’t break the build. There have been 43 dependency updates so far on this project, none have failed so far (before upgrading Firebase).
Actual behavior
I can’t paste firebase-debug.log
because it gets auto-deleted.
GH Actions log
4s
Run cd functions && npm run build
> build
> tsc
node_modules/firebase-functions/lib/common/params.d.ts(6,125): error TS1110: Type expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,138): error TS1005: '}' expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,142): error TS1128: Declaration or statement expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,180): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,181): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,188): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,194): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,198): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(6,205): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,66): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,68): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,75): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,81): error TS1128: Declaration or statement expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,82): error TS1109: Expression expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,84): error TS1109: Expression expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,111): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,113): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,120): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,126): error TS1128: Declaration or statement expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,127): error TS1109: Expression expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,128): error TS1109: Expression expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,155): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,157): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(21,164): error TS1005: ';' expected.
node_modules/firebase-functions/lib/common/params.d.ts(33,1): error TS1160: Unterminated template literal.
Error: Process completed with exit code 2.
Deploy log from the Terminal
❯ firebase deploy --only functions
=== Deploying to 'tooling'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint --ext .js,.ts .
Running command: npm --prefix "$RESOURCE_DIR" run build
> build
> tsc
node_modules/firebase-functions/lib/common/params.d.ts:6:125 - error TS1110: Type expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~~~
node_modules/firebase-functions/lib/common/params.d.ts:6:138 - error TS1005: '}' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~~~~
node_modules/firebase-functions/lib/common/params.d.ts:6:142 - error TS1128: Declaration or statement expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~
node_modules/firebase-functions/lib/common/params.d.ts:6:180 - error TS1005: ';' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~
node_modules/firebase-functions/lib/common/params.d.ts:6:181 - error TS1005: ';' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~
node_modules/firebase-functions/lib/common/params.d.ts:6:188 - error TS1005: ';' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~~~~
node_modules/firebase-functions/lib/common/params.d.ts:6:194 - error TS1005: ';' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~
node_modules/firebase-functions/lib/common/params.d.ts:6:198 - error TS1005: ';' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~
node_modules/firebase-functions/lib/common/params.d.ts:6:205 - error TS1005: ';' expected.
6 export declare type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${D}${infer Tail}` ? [...Split<Tail, D>] : S extends `${infer Head}${D}${infer Tail}` ? string extends Head ? [...Split<Tail, D>] : [Head, ...Split<Tail, D>] : [
~~~~
node_modules/firebase-functions/lib/common/params.d.ts:21:66 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:68 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:75 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~~~~~
node_modules/firebase-functions/lib/common/params.d.ts:21:81 - error TS1128: Declaration or statement expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:82 - error TS1109: Expression expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~~
node_modules/firebase-functions/lib/common/params.d.ts:21:84 - error TS1109: Expression expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:111 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:113 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:120 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~~~~~
node_modules/firebase-functions/lib/common/params.d.ts:21:126 - error TS1128: Declaration or statement expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:127 - error TS1109: Expression expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:128 - error TS1109: Expression expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:155 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:157 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~
node_modules/firebase-functions/lib/common/params.d.ts:21:164 - error TS1005: ';' expected.
21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;
~~~~~
node_modules/firebase-functions/lib/common/params.d.ts:33:1 - error TS1160: Unterminated template literal.
33
Found 25 errors.
Error: functions predeploy error: Command terminated with non-zero exit code 2
Having trouble? Try firebase [command] --help
Firebase Admin upgrade fails with similar TSC problems.
Were you able to successfully deploy your functions?
No, shared above.
Priority
High priority, but not urgent.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
same issue here I had to roll back to firebase-functions@3.24.1 to for firebase serve to detect my functions
otherwise I get a
✔ functions: Loaded functions definitions from source: .
@milosmns Hmm… I know we use peer dependencies to cause warnings with the admin SDK but we obviously take TypeScript as a dev dependency since JavaScript developers don’t need it. Maybe those conflicts don’t create warnings 😒. May consider different ways of surfacing the warning.