Save Empty value to Firebase

Describe the issue/error/question

Hi
How to save empty data in Firestone?
I have this data

[
   {
      "CustomerID":"5677104918691840",
      "points":"153",
      "ProgramID":"4528459062706176",
      "email":"",
      "firstName":"Iago",
      "lastName":"Espindula",
      "phone":"+5551989033894",
      "humanName":"Iago Espindula"
   }
]

What is the error message (if any)?

After the set, it gives me this error in the Firestone node
ERROR: Bad request - please check your parameters
Invalid value at ‘writes[0].update.fields[3].value.integer_value’ (TYPE_INT64), “”

I think it’s related to the email being “”
hot to convert that to Null or something that Firestone accepts as null, or don’t even send empty results to Firestone?

Thanks

Hi @zupy, I could insert your example data just fine using the below workflow:

This is how the data looks in the Firestore console:

Are you possibly trying to insert multiple items at the same time of which one (or more) have a different data structure? Or are you running an operation other than document: create? If so, could you share your node?

1 Like

I’m using upsert

Everything works, if the field is not empty

Yes, i’m trying to input several items, and I think the problem is in the SET node, all have the same data structure

[
{
"CustomerID": "4507661716422656",
"points": "127",
"ProgramID": "5649993148923904",
"email": "[email protected]",
"firstName": "Victor",
"lastName": "Portocarrero",
"phone": "+5511975678419",
"humanName": "Victor Portocarrero"
},
{
"CustomerID": "4537068554813440",
"points": "5",
"ProgramID": "5649993148923904",
"email": "",
"firstName": "",
"lastName": "",
"phone": "",
"humanName": "Desconhecido #4537068554813440"
},
{
"CustomerID": "4539029947154432",
"points": "15",
"ProgramID": "5649993148923904",
"email": "[email protected]",
"firstName": "Ariane",
"lastName": "Moreira",
"phone": "+5511991736755",
"humanName": "Ariane Moreira"
}
]

And I get these error

{"message":"400 - {\"error\":{\"code\":400,\"message\":\"Invalid value at 'writes[1].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[21].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[27].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[29].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[45].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[56].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[62].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[106].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[116].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[125].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[151].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[164].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[165].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[175].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[191].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[200].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[207].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[264].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\\nInvalid value at 'writes[280].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\",\"status\":\"INVALID_ARGUMENT\",\"details\":[{\"@type\":\"type.googleapis.com/google.rpc.BadRequest\",\"fieldViolations\":[{\"field\":\"writes[1].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[1].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[21].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[21].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[27].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[27].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[29].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[29].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[45].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[45].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[56].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[56].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[62].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[62].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[106].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[106].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[116].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[116].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[125].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[125].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[151].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[151].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[164].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[164].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[165].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[165].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[175].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[175].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[191].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[191].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[200].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[200].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[207].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[207].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[264].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[264].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"},{\"field\":\"writes[280].update.fields[3].value.integer_value\",\"description\":\"Invalid value at 'writes[280].update.fields[3].value.integer_value' (TYPE_INT64), \\\"\\\"\"}]}]}}","name":"Error","stack":"Error: Request failed with status code 400\n    at createError (/usr/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/usr/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:549:35)\n    at endReadableNT (node:internal/streams/readable:1359:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}