升级Firebase相关版本后部分触发器报参数错误求助
Let's get straight to the root of your problem: your dependency versions are out of sync, and that's causing conflicts between the new firebase-functions v2.x and the outdated firebase-admin v5.13.0 you're still using. Node 8's runtime expects a more modern API that your old admin package can't provide, which is why you're seeing that event parameter mismatch error.
What's Specifically Wrong:
firebase-functionsv2.x is built for Node 8+, but it requires a compatiblefirebase-adminversion (at least v6.x, preferably newer). Your v5.13.0 admin package uses outdated APIs that clash with the new functions runtime, leading to the event parameter error.- Your TypeScript version (3.1.3) is also fairly old—while it might compile your code, it could be missing type definitions that the newer Firebase packages rely on, adding to runtime confusion.
Step-by-Step Fixes:
1. Update Your Dependencies to Compatible Versions
Replace the dependencies in your package.json with this set of stable, Node 8-compatible versions:
"dependencies": { "@firebase/database": "^0.10.0", "cors": "^2.8.5", "elasticsearch": "^16.7.3", "firebase-admin": "^8.13.0", "firebase-functions": "^3.14.1", "moment": "^2.29.4", "nodemailer": "^6.9.1", "request": "^2.88.2", "request-promise": "^4.2.6", "stripe": "^8.222.0", "twilio": "^3.86.1", "twitter": "^1.7.1" }, "devDependencies": { "tslint": "^6.1.3", "typescript": "^3.9.10" }
These are the latest stable releases fully compatible with Node 8—you can cross-verify each package's engines field if you want to double-check compatibility.
2. Audit Your wasTriggered Function
Your trigger calls wasTriggered(context.eventId, 'userFollowingChanged')—make sure this custom function isn't using deprecated Firebase APIs. For example:
- Avoid accessing private properties on the
contextobject - If it's meant to prevent duplicate triggers, confirm it correctly handles the
eventIdin the new runtime
3. Recompile and Deploy
Run these commands to refresh dependencies, build your code, and push it to Firebase:
npm install npm run build firebase deploy --only functions
Quick Validation Tips:
- Test locally first with
firebase functions:shell—simulate a Firestore write event to see if the error disappears - Check your function logs with
firebase functions:logto catch any hidden compatibility issues
内容的提问来源于stack exchange,提问作者Aswin T K

