I have currently 10 working functions in my firebase:functions. Now I try to create a pdf inside a rtdb-trigger-function. The problem is, as soon as I require pdfkit:
const pdfkit = require('pdfkit');
All of my functions can not be updated: Function failed on loading user code. This is likely due to a bug in the user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
I installed pdfkit via npm: npm install pdfkit This is the output:
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
up to date, audited 465 packages in 2s
52 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
This is my package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"dependencies": {
"busboy-firebase": "^1.0.7",
"check-node-version": "^4.2.1",
"firebase-admin": "^11.4.1",
"firebase-functions": "^4.1.1",
"mailgun": "^0.5.0",
"node": "^16.1.0",
"node-fetch": "^2.6.1",
"nodemailer": "^6.6.1"
},
"devDependencies": {
"@google-cloud/tasks": "^2.1.2",
"@types/pdfkit": "^0.12.8",
"busboy": "^1.6.0",
"cors": "^2.8.5",
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.1.6",
"pdfkit": "^0.13.0"
},
"private": true
}
What is wrong?
Thank you!
This is what I did:
- Try node version 10,12,14,16
- Installed node 16.4.0
- npm install pdfkit