I have been trying to deploy the following function for days. This is the code and the errors. It appears on my google cloud platform but it is not working properly.
const functions = require("firebase-functions");
const admin = require("firebase-admin");
admin.initializeApp();
const database = admin.firestore();
// prettier-ignore
exports.schFunc = functions.region("us-east1").pubsub
.schedule("every 1 minutes")
.onRun((context) => {
database
.doc("timers/timer1")
.update({time: admin.firestore.Timestamp.now()});
return console.log("succesful timer update");
});
These are the errors.
<<< HTTP RESPONSE BODY {"error":{"code":400,"message":"Any resource that needs App Engine can only be created/updated in the App Engine region. Location must equal us-east1 because the App Engine app that is associated with this project is located in us-east1.","status":"INVALID_ARGUMENT"}}
<<< HTTP RESPONSE BODY {"error":{"code":404,"message":"Job not found.","status":"NOT_FOUND"}}
And this is what is showing when I deploy.
Error: Failed to upsert schedule function schFunc in region us-east1
Error: There was an error deploying functions