Supabase Node adding 000 to UID

Describe the problem/error/question

When using the supabase node I am pulling an int8 from supabase and it is adding 000 to the end of the number, in this case it is video_uid

Please share your workflow

I cant share the workflow because i have keys exposded but I will provide a snippet of the output directly from the supabase get many rows node.
I have tried to use a set node to go to a string after pulling the rows but the 000 stays the same.

{
“id”: 24,
“created_at”: “2023-11-09T04:26:46.850253+00:00”,
“account_id”: 384,
“video_caption”: "New Ada design got me like #residentevil #residentevil4 #re4remake #ada #adawong #adawongcosplay ",
“video_url”: "https://v16m…,
“sound_id”: null,
“video_uid”: 7217199981235539000,
“posted_date”: 1680385326
},
{
“id”: 25,
“created_at”: “2023-11-09T04:26:46.850253+00:00”,
“account_id”: 384,
“video_caption”: "Meow ",
“video_url”: “https://…”,
“sound_id”: null,
“video_uid”: 7216760320411340000,
“posted_date”: 1680282961
}

Information on your n8n setup

  • n8n version: Latest
  • Database (default: SQLite): Default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker Compose
  • Operating system: Linux

Hi @Zac_Magee

The other numeric values do not have this I see.
Are we sure it is not something to do with the field you have in supabase? Doesn’t make any sense for the n8n node to add it. Normally nodes are not really doing any data transformation.

Hey @BramKn
You are correct, it is just the video UID. I had a similar problem with Airtable and UIDs (i was just using numbers not an official UID) when I would update a number field inside Airtable. Once I changed the Airtable field to a text field the issue went away so I assumed it was Airtable. That was on a cloud account now I am self hosted. Now it is happening inside the Supabase node. I have replicated it a few times and it seems to be very consistent with 000.
I tried changing the video_uid field from int4 to int8 and I got the same issue.
I must have something wrong but chatgpt and I can not figure out what haha.

So if you put in an extra number does it only add 00?
I dont have a supabase handy to test this for you sadly.

So at the moment I am not changing them at all, I am just calling the database using the get many rows node. Then the node returns the video_ids with the extra 000 added to the end.
That’s fine I have many other things to do anyway

Update.

I am working on an edge function for supabase just using the CLI and I am having the same issue. When pulling the video_uid in it is adding 000 to each UID.
I am assuming this is a javascript issue? Any solutions around this?

{
id: 22,
created_at: ‘2023-11-09T04:26:46.850253+00:00’,
account_id: 384,
video_caption: ‘’,
video_url: ‘https://…’,
sound_id: null,
video_uid: 7220145627865288000,
posted_date: 1681071160
},
{
id: 23,
created_at: ‘2023-11-09T04:26:46.850253+00:00’,
account_id: 384,
video_caption: ‘I don’t really like this vid but i love my makeup so eh here’,
video_url: ‘https://…’,
sound_id: null,
video_uid: 7217872433909435000,
posted_date: 1680541906
},
{
id: 24,
created_at: ‘2023-11-09T04:26:46.850253+00:00’,
account_id: 384,
video_caption: 'New Ada design got me like #residentevil #residentevil4 #re4remake #ada #adawong #adawongcosplay ',
video_url: ‘https://…’,
sound_id: null,
video_uid: 7217199981235539000,
posted_date: 1680385326
},

Hi @Zac_Magee, it looks to me like you’re spot on here. A value such as 7217872433909435000 is larger than the max safe integer of 9007199254740991, so JavaScript applications like n8n will not be able to process it as a numeric value.

Perhaps you can query such Supabase data using Postgresql, and then cast the value into a text in your SELECT query? This should prevent any JS-specific problems with large numbers.

1 Like

Hey @MutedJam Thank you for your reply.

What is the best way to do this? I have converted the column to text to get around it for now but for future reference, is there a way to directly query using PostgreSQL inside n8n? Or am I best just keeping it as a text field?

Ah sorry @Zac_Magee, I had only very little time yesterday for the forum so only posted a brief response.

But my idea was to simply use the Postgres node (since Supabase is built on top of PostgreSQL) as described here:

Then for your int8 column with values such as 7217872433909435123 run a query like SELECT id::text FROM table_with_very_long_ids;. The syntax ::text is a shorthand for the PostgreSQL CAST command.

The Postgres node will return the correct value as a string (even if your data type is numeric):

The Supabase node will not as it would use a JavaScript Number datatype:

1 Like

Hey @MutedJam No need to apologize I appreciate your response!

Funny you say that, GPT told me to use the “Database” node and I told it off saying that there is no such thing haha.

I will start to implement this today! I am always surprise by the sheer power of n8n and this is once again no exception!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.