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/google.rpc.BadRequest, fieldViolations=[field=runtime, description=Runtime field cannot be empty.]]
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:
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked May 30, 2019 at 20:48 SimonSimon 2,5384 gold badges36 silver badges82 bronze badges 7[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./google.rpc.BadRequest, fieldViolations=[field=runtime, description=Runtime field cannot be empty.]]
-
2
Run the mand with
--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 Commented May 30, 2019 at 20:55 -
@DougStevenson Thanks, I edited the question to include the information from the
--debug
flag – Simon Commented May 30, 2019 at 21:01 - Make sure your CLI is fully up to date, try again, and contact Firebase support directly if you still have problems. support.google./firebase/contact/support – Doug Stevenson Commented May 30, 2019 at 21:09
- @DougStevenson Thanks, I figured it out and answered my own question :) – Simon Commented May 30, 2019 at 21:12
- For me running "npm install -g firebase-tools" solved the problem – yital9 Commented Sep 10, 2019 at 12:45
2 Answers
Reset to default 3I experienced this issue because my path was incorrect. I had it like this:
functions.firestore
.document('/panies/{panyID}/tickets/')
.onCreate((change, context) => {
// code here.
})
Instead of:
functions.firestore
.document('/panies/{panyID}/tickets')
.onCreate((change, context) => {
// code here.
})
Note the slash at the end of the path.
In my case I had to change
export const onRatingCreated = functions.firestore.document('Programs/{programId}/Ratings/').onCreate((doc, context) => {
// ...
});
To this
export const onRatingCreated = functions.firestore.document('Programs/{programId}/Ratings/{ratingId}').onCreate((doc, context) => {
// ...
});
So, ending with a Document wildcard fixed it for me.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744990406a4604868.html
评论列表(0条)