I'm running into a strange issue.
I'm trying to use 2 wildcards
and I keep getting an error saying:
! functions: failed to create function modRemoveReplies
HTTP Error: 400, The request has errors
The interesting thing is that I have another export
that uses almost the same wildcards but doesn't produce an error...
This is the code where I get an error:
exports.modRemoveReplies = functions.database
.ref('replies/{parent}/{postId}/flag_delete')
.onCreate(async (snapshot, context) => {
console.log("Test")
return true;
});
but earlier in my functions file I call this code with absolute no errors:
exports.removeReply = functions.database
.ref('replies/{parent}/{postId}/score')
.onUpdate(async change => {
const score = change.after.val();
if (score === -4) {
return change.after.ref.parent.remove();
}
});
It's practically identical so I understand why 'd be getting that error... Any ideas? The error message above is the only information that gets displayed.
Edit:
After running with the --debug
flag this was the output:
[2019-05-30T20:55:47.156Z] <<< HTTP RESPONSE 400 vary=X-Origin, Referer, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, date=Thu, 30 May 2019 20:55:43 GMT, server=ESF, cache-control=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,44,43,39", accept-ranges=none, connection=close
[2019-05-30T20:55:47.156Z] <<< HTTP RESPONSE BODY code=400, message=The request has errors, status=INVALID_ARGUMENT, details=[@type=type.googleapis.com/google.rpc.BadRequest, fieldViolations=[field=runtime, description=Runtime field cannot be empty.]]
--debug
and edit the question to show what it's saying. If the output isn't helpful, you might have to contact Firebase support. – Doug Stevenson--debug
flag – Simon