Error: HTTP Error 400, The Request has errors. Firebase Firestore Cloud Functions
up vote
19
down vote
favorite
While I run the command firebase deploy I get this error:
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
✔ runtimeconfig: all necessary APIs are enabled
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (4.04 KB) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: creating function followerNotification...
⚠ functions: failed to create function followerNotification
⚠ functions: HTTP Error: 400, The request has errors
⚠ functions: 1 function(s) failed to be deployed.
Functions deploy had errors. To continue deploying other features (such as >database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Having trouble? Try firebase deploy --help
Everything else works without problems. Only when I trying to make something with Firebase Firestore.
firebase google-cloud-functions google-cloud-firestore
add a comment |
up vote
19
down vote
favorite
While I run the command firebase deploy I get this error:
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
✔ runtimeconfig: all necessary APIs are enabled
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (4.04 KB) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: creating function followerNotification...
⚠ functions: failed to create function followerNotification
⚠ functions: HTTP Error: 400, The request has errors
⚠ functions: 1 function(s) failed to be deployed.
Functions deploy had errors. To continue deploying other features (such as >database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Having trouble? Try firebase deploy --help
Everything else works without problems. Only when I trying to make something with Firebase Firestore.
firebase google-cloud-functions google-cloud-firestore
add a comment |
up vote
19
down vote
favorite
up vote
19
down vote
favorite
While I run the command firebase deploy I get this error:
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
✔ runtimeconfig: all necessary APIs are enabled
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (4.04 KB) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: creating function followerNotification...
⚠ functions: failed to create function followerNotification
⚠ functions: HTTP Error: 400, The request has errors
⚠ functions: 1 function(s) failed to be deployed.
Functions deploy had errors. To continue deploying other features (such as >database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Having trouble? Try firebase deploy --help
Everything else works without problems. Only when I trying to make something with Firebase Firestore.
firebase google-cloud-functions google-cloud-firestore
While I run the command firebase deploy I get this error:
i deploying functions
i functions: ensuring necessary APIs are enabled...
i runtimeconfig: ensuring necessary APIs are enabled...
✔ runtimeconfig: all necessary APIs are enabled
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (4.04 KB) for uploading
✔ functions: functions folder uploaded successfully
i starting release process (may take several minutes)...
i functions: creating function followerNotification...
⚠ functions: failed to create function followerNotification
⚠ functions: HTTP Error: 400, The request has errors
⚠ functions: 1 function(s) failed to be deployed.
Functions deploy had errors. To continue deploying other features (such as >database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
Having trouble? Try firebase deploy --help
Everything else works without problems. Only when I trying to make something with Firebase Firestore.
firebase google-cloud-functions google-cloud-firestore
firebase google-cloud-functions google-cloud-firestore
asked Oct 18 '17 at 19:48
Loyal
11228
11228
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
up vote
42
down vote
accepted
This was happening to me too, then I realized that at the 2nd level, firestore only allows documents and not collections.
I was attempting to listen to this path:
/collection/document/{wildcard}
You can either to something like
/collection/{wildcard}
or
/collection/document/collection/{wildcard}
1
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
add a comment |
up vote
5
down vote
The problem is that you only reference a collection and not a document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You need to reference the document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You can also use a wildcard like:
exports.myFunctionName = functions.firestore
.document('users/{userId}').onWrite((event) => {
// ... Your code here
});
It's described in here: https://firebase.google.com/docs/functions/firestore-events
Hope I could help
add a comment |
up vote
5
down vote
I had this problem as well. In my case it was because my trigger path had a trailing slash in the document path.
So changing:
functions.firestore
.document('some_path/{pushId}/')
To:
functions.firestore
.document('some_path/{pushId}')
Fixed it it for me. It seems like this is caused by a variety of issues and the firebase cli does not do a good job at explaining the reasons why.
add a comment |
up vote
0
down vote
The issue was probably caused by the length of the function name.
So, if the name is:
myFunctionsFromWorksWithCustumersTiggersTests
change for a shorter name, like:
WorkWithCustumers
I hope I helped.
add a comment |
up vote
0
down vote
My issue with the same error message was that Cloud Functions' pubsub doesn't seem to support topics with names beginning with numeral characters.
add a comment |
up vote
0
down vote
I had the same error when trying to publish a function listening to a Cloud pub/sub, that began with numerical characters.
exports.nightly_pruning = functions.pubsub.topic('24hr-tick').onPublish((event) => {
...
});
Fixed it by simply changing the name:
exports.nightly_pruning = functions.pubsub.topic('nightly-tick').onPublish((event) => {
...
});
(Thanks to Nikolai Hegelstad above. I don't have the reputation to comment.)
2
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46818082%2ferror-http-error-400-the-request-has-errors-firebase-firestore-cloud-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
42
down vote
accepted
This was happening to me too, then I realized that at the 2nd level, firestore only allows documents and not collections.
I was attempting to listen to this path:
/collection/document/{wildcard}
You can either to something like
/collection/{wildcard}
or
/collection/document/collection/{wildcard}
1
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
add a comment |
up vote
42
down vote
accepted
This was happening to me too, then I realized that at the 2nd level, firestore only allows documents and not collections.
I was attempting to listen to this path:
/collection/document/{wildcard}
You can either to something like
/collection/{wildcard}
or
/collection/document/collection/{wildcard}
1
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
add a comment |
up vote
42
down vote
accepted
up vote
42
down vote
accepted
This was happening to me too, then I realized that at the 2nd level, firestore only allows documents and not collections.
I was attempting to listen to this path:
/collection/document/{wildcard}
You can either to something like
/collection/{wildcard}
or
/collection/document/collection/{wildcard}
This was happening to me too, then I realized that at the 2nd level, firestore only allows documents and not collections.
I was attempting to listen to this path:
/collection/document/{wildcard}
You can either to something like
/collection/{wildcard}
or
/collection/document/collection/{wildcard}
answered Oct 23 '17 at 3:06
Ivan
1,8491910
1,8491910
1
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
add a comment |
1
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
1
1
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
Same issue here! Weird that there's no descriptive error message for this.
– Matt Logan
Jun 10 at 22:36
add a comment |
up vote
5
down vote
The problem is that you only reference a collection and not a document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You need to reference the document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You can also use a wildcard like:
exports.myFunctionName = functions.firestore
.document('users/{userId}').onWrite((event) => {
// ... Your code here
});
It's described in here: https://firebase.google.com/docs/functions/firestore-events
Hope I could help
add a comment |
up vote
5
down vote
The problem is that you only reference a collection and not a document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You need to reference the document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You can also use a wildcard like:
exports.myFunctionName = functions.firestore
.document('users/{userId}').onWrite((event) => {
// ... Your code here
});
It's described in here: https://firebase.google.com/docs/functions/firestore-events
Hope I could help
add a comment |
up vote
5
down vote
up vote
5
down vote
The problem is that you only reference a collection and not a document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You need to reference the document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You can also use a wildcard like:
exports.myFunctionName = functions.firestore
.document('users/{userId}').onWrite((event) => {
// ... Your code here
});
It's described in here: https://firebase.google.com/docs/functions/firestore-events
Hope I could help
The problem is that you only reference a collection and not a document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You need to reference the document like:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
You can also use a wildcard like:
exports.myFunctionName = functions.firestore
.document('users/{userId}').onWrite((event) => {
// ... Your code here
});
It's described in here: https://firebase.google.com/docs/functions/firestore-events
Hope I could help
answered Oct 21 '17 at 19:45
Raphael Jenni
1365
1365
add a comment |
add a comment |
up vote
5
down vote
I had this problem as well. In my case it was because my trigger path had a trailing slash in the document path.
So changing:
functions.firestore
.document('some_path/{pushId}/')
To:
functions.firestore
.document('some_path/{pushId}')
Fixed it it for me. It seems like this is caused by a variety of issues and the firebase cli does not do a good job at explaining the reasons why.
add a comment |
up vote
5
down vote
I had this problem as well. In my case it was because my trigger path had a trailing slash in the document path.
So changing:
functions.firestore
.document('some_path/{pushId}/')
To:
functions.firestore
.document('some_path/{pushId}')
Fixed it it for me. It seems like this is caused by a variety of issues and the firebase cli does not do a good job at explaining the reasons why.
add a comment |
up vote
5
down vote
up vote
5
down vote
I had this problem as well. In my case it was because my trigger path had a trailing slash in the document path.
So changing:
functions.firestore
.document('some_path/{pushId}/')
To:
functions.firestore
.document('some_path/{pushId}')
Fixed it it for me. It seems like this is caused by a variety of issues and the firebase cli does not do a good job at explaining the reasons why.
I had this problem as well. In my case it was because my trigger path had a trailing slash in the document path.
So changing:
functions.firestore
.document('some_path/{pushId}/')
To:
functions.firestore
.document('some_path/{pushId}')
Fixed it it for me. It seems like this is caused by a variety of issues and the firebase cli does not do a good job at explaining the reasons why.
answered Feb 8 at 22:17
adamduren
1,733198
1,733198
add a comment |
add a comment |
up vote
0
down vote
The issue was probably caused by the length of the function name.
So, if the name is:
myFunctionsFromWorksWithCustumersTiggersTests
change for a shorter name, like:
WorkWithCustumers
I hope I helped.
add a comment |
up vote
0
down vote
The issue was probably caused by the length of the function name.
So, if the name is:
myFunctionsFromWorksWithCustumersTiggersTests
change for a shorter name, like:
WorkWithCustumers
I hope I helped.
add a comment |
up vote
0
down vote
up vote
0
down vote
The issue was probably caused by the length of the function name.
So, if the name is:
myFunctionsFromWorksWithCustumersTiggersTests
change for a shorter name, like:
WorkWithCustumers
I hope I helped.
The issue was probably caused by the length of the function name.
So, if the name is:
myFunctionsFromWorksWithCustumersTiggersTests
change for a shorter name, like:
WorkWithCustumers
I hope I helped.
edited Feb 20 at 15:36
Gibin Ealias
1,3623525
1,3623525
answered Feb 20 at 13:25
Mathias Gheno Azzolini
9012
9012
add a comment |
add a comment |
up vote
0
down vote
My issue with the same error message was that Cloud Functions' pubsub doesn't seem to support topics with names beginning with numeral characters.
add a comment |
up vote
0
down vote
My issue with the same error message was that Cloud Functions' pubsub doesn't seem to support topics with names beginning with numeral characters.
add a comment |
up vote
0
down vote
up vote
0
down vote
My issue with the same error message was that Cloud Functions' pubsub doesn't seem to support topics with names beginning with numeral characters.
My issue with the same error message was that Cloud Functions' pubsub doesn't seem to support topics with names beginning with numeral characters.
answered Jun 18 at 14:15
Nikolai Hegelstad
6410
6410
add a comment |
add a comment |
up vote
0
down vote
I had the same error when trying to publish a function listening to a Cloud pub/sub, that began with numerical characters.
exports.nightly_pruning = functions.pubsub.topic('24hr-tick').onPublish((event) => {
...
});
Fixed it by simply changing the name:
exports.nightly_pruning = functions.pubsub.topic('nightly-tick').onPublish((event) => {
...
});
(Thanks to Nikolai Hegelstad above. I don't have the reputation to comment.)
2
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
add a comment |
up vote
0
down vote
I had the same error when trying to publish a function listening to a Cloud pub/sub, that began with numerical characters.
exports.nightly_pruning = functions.pubsub.topic('24hr-tick').onPublish((event) => {
...
});
Fixed it by simply changing the name:
exports.nightly_pruning = functions.pubsub.topic('nightly-tick').onPublish((event) => {
...
});
(Thanks to Nikolai Hegelstad above. I don't have the reputation to comment.)
2
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
add a comment |
up vote
0
down vote
up vote
0
down vote
I had the same error when trying to publish a function listening to a Cloud pub/sub, that began with numerical characters.
exports.nightly_pruning = functions.pubsub.topic('24hr-tick').onPublish((event) => {
...
});
Fixed it by simply changing the name:
exports.nightly_pruning = functions.pubsub.topic('nightly-tick').onPublish((event) => {
...
});
(Thanks to Nikolai Hegelstad above. I don't have the reputation to comment.)
I had the same error when trying to publish a function listening to a Cloud pub/sub, that began with numerical characters.
exports.nightly_pruning = functions.pubsub.topic('24hr-tick').onPublish((event) => {
...
});
Fixed it by simply changing the name:
exports.nightly_pruning = functions.pubsub.topic('nightly-tick').onPublish((event) => {
...
});
(Thanks to Nikolai Hegelstad above. I don't have the reputation to comment.)
answered Nov 12 at 2:18
Aidan Davis
11
11
2
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
add a comment |
2
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
2
2
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
I feel like this is a bit more noise, then an actual answer. You've basically just implemented Nikolai's solution. You should either edit their answer to include an example, or consider gaining enough reputation for a comment/upvote.
– FrankerZ
Nov 12 at 2:30
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
It's a genuine answer. I've considered gaining more reputation - and answering questions like this is the way to do so. I am just trying to add value where I can, and due to my current reputation (because I haven't spent a lot of time giving back to stack overflow, this was the only way I could).
– Aidan Davis
Nov 13 at 4:28
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46818082%2ferror-http-error-400-the-request-has-errors-firebase-firestore-cloud-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown