Random problems trying to create a row in Supabase

Hi everyone, I am having issues trying to create rows with the Supabase node. Issues seem random, that is, the workflow works until it stops without any prior changes made.

The error message I get is " ERROR: Bad request - please check your parameters. All object keys must match".

All values are mapped correctly and I noticed the following: 1) some parameters (which strings, like a name or an address) sometimes get accepted and sometimes cause an error, for unknown reasons, at least to me. 2) Yesterday night I added and mapped columns one by one to check what parameters caused the errors and I found three which caused errors. After removing them the workflow worked and the rows were created in Supabase correctly. This morning, I found that it stopped working and n8n shows the error message mentioned above.

The Supabase console shows a generic error 400 without further information.

Any idea would be appreciated.

Thanks!

My workflow:

The output of the last node is:

{"message":"400 - {\"code\":\"PGRST102\",\"details\":null,\"hint\":null,\"message\":\"All object keys must match\"}","name":"Error","stack":"Error: Request failed with status code 400\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:525:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}

I am running n8n cloud (currently in trial).

Thanks for your help!

Alex

Hi @Alessandro_Nurnberg, welcome to the community.

I am very sorry to hear you’re having trouble. The 400 error along All object keys must match would be coming from Supabase and seeing you mentioned how this error happens only sometimes I suspect it has to do with the exact data you’re processing.

Any chance you can share the JSON output from your Set node set companies collection when running into this error?

Hi @MutedJam, sure, please see below. But first let me mention that I just noticed a weird behavior. When creating a test to provide you with the requested JSON output (the trigger is a web hook so I had to enter test mode) the workflow ran successfully and hundreds of rows were created in Supabase - the body in the POST web hook was “IBM”. Now, I tried again with the body set as “Shell” and I got the error.

Question: is it possible that different body strings in the webhook cause the error (that would explain why it seems random).

Anyway, here the JSON output of the node you requested:

[
  {
    "title": "UK SHELL OIL HOLDING LIMITED",
    "address_line_1": "Suite 108 Chase Business Centre",
    "company_number": "07952421",
    "date_of_creation": "2012-02-16",
    "status": "dissolved",
    "locality": "London",
    "postal_code": "N14 5BP"
  },
  {
    "title": "NORTHERN & SHELL TEXT LIMITED",
    "address_line_1": "26-28 Bedford Row",
    "company_number": "03302925",
    "date_of_creation": "1997-01-16",
    "status": "dissolved",
    "locality": "Holborn",
    "postal_code": "WC1R 4HE"
  },
  {
    "title": "SHELL MARINE PRODUCTS LIMITED",
    "address_line_1": "Shell Centre",
    "company_number": "03366341",
    "date_of_creation": "1997-04-30",
    "status": "active",
    "postal_code": "SE1 7NA"
  },
  {
    "title": "SHELL TRINIDAD AND TOBAGO LIMITED",
    "address_line_1": "Shell Centre",
    "company_number": "02386676",
    "date_of_creation": "1989-05-19",
    "status": "active",
    "locality": "London",
    "postal_code": "SE1 7NA"
  },
  {
    "title": "SHELL SEEKERS LIMITED",
    "address_line_1": "Harveys",
    "company_number": "02500912",
    "date_of_creation": "1990-05-10",
    "status": "active",
    "locality": "Hook",
    "postal_code": "RG27 0BL"
  },
  {
    "title": "SHELL PETROLEUM COMPANY LIMITED(THE)",
    "address_line_1": "Shell Centre,",
    "company_number": "00077861",
    "date_of_creation": "1903-06-29",
    "status": "active",
    "postal_code": "SE1 7NA"
  },
  {
    "title": "THE SHELL COMPANY OF THAILAND LIMITED",
    "address_line_1": "Shell Centre",
    "company_number": "00130588",
    "date_of_creation": "1913-08-11",
    "status": "active",
    "postal_code": "SE1 7NA"
  },
  {
    "title": "SHELL COMPANY OF HONG KONG LIMITED (THE)",
    "address_line_1": "Shell Centre",
    "company_number": "00130589",
    "date_of_creation": "1913-08-11",
    "status": "active",
    "postal_code": "SE1 7NA"
  },
  {
    "title": "SHELL U.K. LIMITED",
    "address_line_1": "Shell Centre",
    "company_number": "00140141",
    "date_of_creation": "1915-04-30",
    "status": "active",
    "postal_code": "SE1 7NA"
  },
  {
    "title": "SHELL INTERNATIONAL HOLDINGS LIMITED",
    "address_line_1": "15 Canada Square",
    "company_number": "00150437",
    "date_of_creation": "1918-05-14",
    "status": "dissolved",
    "locality": "London",
    "postal_code": "E14 5GL"
  }
]

Thanks!

@MutedJam I tried to trigger the webhook from my app and I got the same result (see attached screenshot of n8n console): when I search “IBM” the workflow works, when I search “Shell” it throws an error.

I know oil companies are not popular these days, but this is weird :joy:

Thanks!

@MutedJam I tried with more names and I get the same result. Some strings simply throw an error, while others go through just fine and the workflow is successful.

So, it does not seem to be related to the Supabase columns/keys, rather to how certain characters in the body are parsed. Is it possible?

Se attached screenshot of new executions.

Thanks!

So it fails reproducibly for Shell? Which payload exactly does your Set node return for a working vs. a non-working search term?

It fails for some names. For example, it failed for “Shell”, “Bell”, “Ball”, “Barr” and “Brett”, but it works for “IBM”, “Mendell”, “Frett” and “Frell”.

The JSON output in the set node for both failed and successful executions is exactly the same (well, the names change, obviously)

So I’ve tried reproducing the problem using the example data you have provided, but the Supabase node would run fine for me using your Shell data:

I was using the below example workflow:

Do you have perhaps more than 10 items and have just shared the first page passed on to the Supabase node in your workflow?

Also, which data structure exactly does your Subabase table use?

I attach the logs of the api call in Supabase console - the one in yellow is the failed one and the one in green is the successful one

The data structure is exactly the same as your example. Columns are text, except for the dates, for which the type is date.

I do not understand this: "Do you have perhaps more than 10 items and have just shared the first page passed on to the Supabase node in your workflow?

I have more than 10 items, Shell has 540, but IBM has 300+ and it works, while others fail with 3 or 4 items. I don’t understand the “sharing” part…

So I suspect one of the items you’re passing on to Supabase has a different data structure than the others (like a missing property or a date that can’t be parsed). However, using the example data you have provided Supabase won’t throw an error. So I am still looking for a way to reproduce the problem at this stage.

You can share the full JSON output like so:

Recording 2022-09-05 at 12.21.02

If you have a smaller dataset using which the problem can be reproduced that will of course also do.

Sure, you meant the Set node FULL output. Sorry for that, I shared only the first page.

I tried pasting the full output, but it exceeds the max lines allowed here.

I attach the first and last page in jpeg for a failed execution with Dell as body. I hope this helps (otherwise please let me know how to share the full output here)


  • thanks!
type or paste code here

Hi @Alessandro_Nurnberg, any chance you can paste the full response as text so I can easily try using this data on my side? Thank you!

I can share it with you on this Dropbox link

1 Like

Thx so much @Alessandro_Nurnberg, using your example data I can reproduce the problem. I suspect it’s entries like these causing the trouble:

I’ll do some additional testing this afternoon and will get back to you as soon as I can!

1 Like

Thanks a lot!!

Hey @Alessandro_Nurnberg, I could get this to work by setting up my Supabase node like below:

If you look at each expression in my dummy node you can see that I have attached || "" at the end of each string and || null for the date field:

What has happened here is that fields like status are missing for the datasets highlighted in my last message (and presumably also in other affected datasets). So what I am doing with my expressions like {{$node["Mock data"].json["status"] || ""}} is an approach called short-circuiting.

If $node["Mock data"].json["status"] doesn’t return anything (because the property does not exist, the part after the || operator will be returned here (in this case an empty string). Unlike with a missing property Supabase is happy with the empty string so the insert will work as expected.

Could you try running the below node on your end and let me know if you’re still facing trouble? You can simply select it, copy it with Ctrl+C and then paste it in your own canvas with Ctrl+V.

Hi @MutedJam, it works like a charm!!! Thanks so much, as I said in Twitter, I am amazed. More so after seeing you solved my issue so quickly.

BTW, I am in trial period and I will purchase the subscription today. Thanks!!

Alex

1 Like

Hey @Alessandro_Nurnberg, thanks so much for your kind words, I am glad to hear this works :slight_smile:

1 Like