Hi, I’m currently working with firebase cloud function, when I run the code below and copy the endpoint to postman it throws the error status 500 " something went wrong"
and I get an error in the terminal: " The Cloud Firestore emulator is not running, so calls to Firestore will affect production." and: "External network resource requested!
- URL: “http://169.254.169.254/computeMetadata/v1/instance”
- Be careful, this may be a production service."
Here’s the code:
exports.createScream = functions.https.onRequest((req, res) => {
const newScream = {
body: req.body.body,
userHandle: req.body.userHandle,
createdAt: admin.firestore.Timestamp.fromDate(new Date())
};
admin
.firestore()
.collection('screams')
.add(newScream)
.then((doc) => {
res.json({ message: 'document ${doc.id} created successfully'});
})
.catch( (err) => {
res.status(500).json({ error: 'something went wrong'});
console.error(err);
});
});
I’ve tried everything I googled but I get the same result.
Someone should please help me out. Thank you in advance