It has taken over a week to get to what I thought was the last step in getting a JSON string from an end device into a firestore DB.
While following a tutorial the last step was to deploy a function that would take a JSON string and move it into a firestore database. The code for index.js was:
and package.json code was:
But after I clicking deploy I got a message: "Your function is active, but the last deployment failed"
While trying to find out the cause of of my failure, i have gone round and round of things I might need to do most of which lead to something else I need to do. I am afraid that by following some of these suggestions I might be causing more damage than good.
Can anyone tell me in a concise way what I need to do and how to do it. Or better yet a article or site that explains. it.
For example I'm being told to need to have IAM cloud/function deployment rights but I'm not sure that I accomplished that, because I think I need to establish a git account, which I did but I cannot reach it within the cloud desktop so I don't know what to do next. Is there a tutorial on how to deploy a cloud function?
Hi @catotonic,
Welcome to the Google Cloud Community!
You can try the following troubleshooting options:
exports.helloPubSub = (event, context) => {
//code here
};
Let me know if it helped, thanks!
@Marramirez
Thank you for the suggestion. I added the semicolon but no joy, still the same message.
I have no I idea what I'm doing. I just duplicated from an old youtube video which migh be outdated.
I found the log files you pointed out, thanks.
But the errors are cryptic without any suggestion of what to do much less how to do it.
For example "Failed precondition (HTTP 400)"
and
Invalid argument (HTTP 400): Build failed: npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/firebase.admin - Not found npm ERR! 404 npm ERR! 404 'firebase.admin@^6.1.0' is not in this registry.
So my last thank you is for giving me the link to support.
Kind Regards
It seems that you are missing the firebase-admin.
Try installing firebase-admin by doing either of the two:
npm i firebase-admin
npm install --save firebase-admin
To use it in your application, require it from any JS file:
const { initializeApp } = require("firebase-admin/app"); initializeApp();
You can also try Adding the Firebase Admin SDK to your Server if you don't have it already.
Let me know if it helped, thanks!