-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All firestore set(doc) calls fail due to "Error:Argument "documentPath" is not a valid ResourcePath. Path must be a non-empty string" #320
Comments
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information. |
Can you let us know what |
Its a hashcode generated with uuid/v4. Using "uuid": "^3.3.2" |
The error that is thrown from this statement:
This all happens in |
having the same issue code snippet |
@loloDawit Note that your code is missing parenthesis. It should be
instead of
|
that a typo here is the exact code
}) |
I've figured out the issue. the issue is not related to firebase. It's the way I was testing my code using the postman app. The raw data needs to be in JSON format. By default is set to text, it must be changed to JSON(application/json) |
this is from Feedly app cource, a change the like function and works: like(post) {
} where is: "JSON.stringify(body)" I remove JSON.stringify() and left only "body" variable. |
I'm having this issue too, I am leaving JSON.Stringify in as that needs to be in there... Did you find a fix for it? |
any fix for this yet? |
Same issue |
To those still having this issue try:
or use |
@smashah thanks. This is the most straightforward solution |
both these not working for me |
just ran into this in my own project, discovered that the data I was grabbing did, in fact, have an object with an empty key:
|
If you have issues with empty properties then please try stringifying the object then immediately parsing it then sending it to Firestore. E.g
|
Awesome, I'll give it a shot; thanks for the heads up!
…On Sat, Aug 17, 2019, 8:20 AM S.M.A.Sh ***@***.***> wrote:
If you have issues with empty properties then please try stringifying the
object then immediately parsing it then sending it to Firestore.
E.g
.....update(JSON.parse(JSON.stringify(objectToSend)))
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#320?email_source=notifications&email_token=AJ3IAAGVX2LIA5U4BAB75KTQE7UJDA5CNFSM4FMZHXK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QKCNI#issuecomment-522232117>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJ3IAAENIGUEFP4VPHNWU3DQE7UJDANCNFSM4FMZHXKQ>
.
|
The document id you are passing as a reference is not matching with document id in the Firestore in case of an updation. |
Hi All, I have this issue only with a trigger / onCreate - ` } } Thank you, |
@kierandesmond If you are able to deploy the function, then the code you provided is not what's causing the issue, it's probably another line of code inside your function. |
Environment
Problem
While creating a new document/collection in firestore using firebase admin node sdk, within a cloud function, all requests fail with following error:-
Argument "documentPath" is not a valid ResourcePath. Path must be a non-empty string.
at Object.exports.(anonymous function) [as isResourcePath] (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/validate.js:86:15)
at CollectionReference.doc (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/src/reference.js:2113:16)
at Promise (/user_code/lib/api.js:10:37)
at Object.exports.createNewClient (/user_code/lib/api.js:8:12)
at Object. (/user_code/lib/index.js:55:33)
at next (native)
at /user_code/lib/index.js:7:71
at __awaiter (/user_code/lib/index.js:3:12)
at Request.request [as _callback] (/user_code/lib/index.js:47:70)
at Request.self.callback (/user_code/node_modules/request/request.js:185:22)
Steps to reproduce:
Try creating a new doc using firestore -> collection.doc(doc.id).set(doc)
Relevant Code:
My application code that's failing (this was working a few minutes ago and started failing without any changes):-
export const createNewClient = (client) => {
return new Promise((resolve, reject) => {
store.collection("clients").doc(client.id).set(client).then(docRef => {
resolve(client);
}, error => {
reject(error);
});
});
}
The text was updated successfully, but these errors were encountered: