We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Working on MacOS v 14.6.1 Apple M2 node 22.7.0 npm 10.8.2
I passed through the lesson https://firebase.google.com/docs/functions/get-started?hl=en&gen=2nd
And encountered an error ""length" is outside of buffer bounds" after running the function: http://127.0.0.1:5001/povarcloud/us-central1/addmessage
How can I fix it?
Here is the code:
const {logger} = require("firebase-functions"); const {onRequest} = require("firebase-functions/v2/https"); const {onDocumentCreated} = require("firebase-functions/v2/firestore"); // The Firebase Admin SDK to access Firestore. const {initializeApp} = require("firebase-admin/app"); const {getFirestore} = require("firebase-admin/firestore"); initializeApp(); // Take the text parameter passed to this HTTP endpoint and insert it into // Firestore under the path /messages/:documentId/original exports.addmessage = onRequest(async (req, res) => { const original = req.query.text; if (!original) { res.status(400).json({error: "Text parameter is required"}); return; } try { const writeResult = await getFirestore() .collection("messages") .add({original: original}); res.json({result: `Message with ID: ${writeResult.id} added.`}); } catch (error) { res.status(500).json({error: error.message}); } });
UPD: I've fixed it by installing Node 20 instead of Node 22.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Working on MacOS v 14.6.1 Apple M2 node 22.7.0 npm 10.8.2
I passed through the lesson https://firebase.google.com/docs/functions/get-started?hl=en&gen=2nd
And encountered an error ""length" is outside of buffer bounds" after running the function: http://127.0.0.1:5001/povarcloud/us-central1/addmessage
How can I fix it?
Here is the code:
UPD: I've fixed it by installing Node 20 instead of Node 22.
The text was updated successfully, but these errors were encountered: