Working with Bolt.new and Supabase AI, read only?

Hello, Im new trying to use supabase with Bolt.new and Im struggling. It seems the changes Im making in bolt are not pushed into my table. So I tried to edit my table with the AI and its read only? I understand nothing about the policies and what not. Any help is appreciated.
85 Replies
BE_PMAinc
BE_PMAincOP2w ago
Even using the SQL editor it doesnt seem to work. I dont understand, BOLT correctly create the table with the rows and what not, but it fails at adding content. Only way I found so far is to ask it to make a .CSV and upload that.
silentworks
silentworks2w ago
You haven't shown anything that you have tried so not much we can help you with here. Telling and not showing isn't very helpful. You mentioned the SQL editor not working but what does that mean? what did you actually try to do there? what error did you get?
BE_PMAinc
BE_PMAincOP2w ago
Valid points, the thing is, there is not much to show because as stated, BOLT is failing to change the table. When I use the SQL editor. I often get the message "Success. No rows returned" but the rows are not added. I do a search and they are not there. I asked the supabase AI to do the change itself, and I get that message "ERROR: cannot execute ALTER TABLE in a read-only transaction". So I asked the Supabase AI to edit the policies to allow both itself and bolt.new to make alteration to the table, and I get a similar message. So in short my question is, how do I setup the policies or anything else so the AI can change the tables?
BE_PMAinc
BE_PMAincOP2w ago
INSERT INTO translations (key, value, lang, namespace) VALUES ('dashboard.title', 'Tableau de bord', 'fr', 'translation'),
No description
BE_PMAinc
BE_PMAincOP2w ago
ok it seems search using the browser doesnt work. so I guess the SQL function work.
No description
BE_PMAinc
BE_PMAincOP2w ago
I could share my screen, whenever you are available if you want and its permitted.
BE_PMAinc
BE_PMAincOP2w ago
return ( <PageLayout title={t('translation:dashboard.title')} subtitle={t('translation:dashboard.subtitle')}
No description
BE_PMAinc
BE_PMAincOP2w ago
No description
silentworks
silentworks2w ago
Policies doesn't stop you from making changes and wouldn't trigger a cannot execute error message. This is more likely a grant issue. How was the translations table created? are you getting the error when trying to alter the translations table?
BE_PMAinc
BE_PMAincOP2w ago
it was created by BOLT, but the table itself was empty, I had to use a SQL to fill it, or I used .CSV in another instance.
silentworks
silentworks2w ago
Row level security (RLS) is already enabled on this table, so even if the ALTER was successful it wouldn't be doing anything to the table. Your table doesn't seem to be read only as you've inserted data via the SQL editor and I'm sure you can probably insert data via the Table editor too.
BE_PMAinc
BE_PMAincOP2w ago
yes it works that way so there is a policy that says its read only, but its not really read only because I can edit it? I thought that was only for any modification coming from outsite the supabase interface
silentworks
silentworks2w ago
There is no policy that says it's read only. Oh wait, yes the policy you created is for SELECT (read) only, so you would need to add an INSERT policy if you want to write to that table.
BE_PMAinc
BE_PMAincOP2w ago
yeah I was confused...
No description
silentworks
silentworks2w ago
You can edit from the Supabase Dashbard because the Dashboard uses an elevated user that bypasses RLS.
BE_PMAinc
BE_PMAincOP2w ago
yeah that makes sense, so the policies have no impact when using the supabase UI. Ok so I need a write policies for Bolt.new to be able to make changes?
silentworks
silentworks2w ago
No not in it's default state. You can however test the policies by changing the role of the user inside of the Supabase Dashboard
silentworks
silentworks2w ago
I don't know how Bolt.new works so cannot advice you on that.
BE_PMAinc
BE_PMAincOP2w ago
Yeah well It seems they are integrated into each other. Im sure others are using Supabase effectively using Bolt.New so Im wondering if Im doing something wrong in Supabase.
No description
silentworks
silentworks2w ago
Probably better to ask in the supabase channel in the Bolt discord.
BE_PMAinc
BE_PMAincOP2w ago
I will check there... so what you are saying is that everything seems fine on the SupaBase side and Bolt should be able to write into it. So, if it doesnt, its a bold problem? if there is no write policies on that table, how can bolt write into it if its read only? Can you help me test that? Because right now Im failing to make a policie.
BE_PMAinc
BE_PMAincOP2w ago
No description
silentworks
silentworks2w ago
Yet again I don't know how bolt works, I don't know what role bolt AI uses. You are best asking on their discord.
BE_PMAinc
BE_PMAincOP2w ago
I understand, all I am asking is help to open all the doors so I can eliminate that as a possible blocade.
silentworks
silentworks2w ago
There is no 1 size fits all policy. Row level security policies are based on your project requirements. You should read up on them and understand how they work before continuing any further. I don't understand what you are asking here? are you asking how to disable RLS so you can test to see if its the cause of Bolt not being able to write to the table?
BE_PMAinc
BE_PMAincOP2w ago
Ya
silentworks
silentworks2w ago
In this screenshot there is a Disable RLS button, just click on it and it should be disabled.
BE_PMAinc
BE_PMAincOP2w ago
k Im gonna try that. is there an effective way to filter to find a key or a value with a part of the key value and not EXACTLY what it is since the search fonction of the browser doesnt work with the supabase table?
silentworks
silentworks2w ago
There is a filter option in the Table editor.
BE_PMAinc
BE_PMAincOP2w ago
yeah the Bolt.new AI is confused not its not attempting to update the database probably because of my previous queries, it game me a SQL that correctly updated the database but its not finding the result.
No description
No description
BE_PMAinc
BE_PMAincOP2w ago
yeah but it seems it only works with the EXACT query, not just "Test" for instance
BE_PMAinc
BE_PMAincOP2w ago
See :
No description
silentworks
silentworks2w ago
You should read up on how SQL filters work, it will give you a better understanding of how to use the UI. The UI uses SQL filters.
BE_PMAinc
BE_PMAincOP2w ago
why make things simple, right? XD ok it seems to me that im at a dead end here... if I show you my fetch code, can you help with that or its beyond your scope?
silentworks
silentworks2w ago
You can share the code here
BE_PMAinc
BE_PMAincOP2w ago
k thanks, 2sec.
silentworks
silentworks2w ago
It's literally as simple as it can be. The issue here is you are fully relying on AI but you need to have some understanding of the underlying technologies you are relying on it to help you with. Otherwise everything is going to seem difficult.
BE_PMAinc
BE_PMAincOP2w ago
well if a simple filter require me to into SQL instead of typing "test" and it gives me the rows with the word "test" in them, it sound overly complicated.
silentworks
silentworks2w ago
It's a database, that's how databases work.
BE_PMAinc
BE_PMAincOP2w ago
The filter is part of the database? All Im saying is it should have a "contain", not just equal, greater than... etc.
silentworks
silentworks2w ago
Terminologies are database terminologies, it uses like instead of contain, contain doesn't exist in most relational database systems. This is why I said relying on AI without understanding the underlying technologies won't take you far.
BE_PMAinc
BE_PMAincOP2w ago
No description
BE_PMAinc
BE_PMAincOP2w ago
No description
BE_PMAinc
BE_PMAincOP2w ago
No description
BE_PMAinc
BE_PMAincOP2w ago
seems to me like is not working, or Im dumb. omg my "i18n.ts" is .ts, this is incorrect, right? import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import HttpBackend from 'i18next-http-backend'; import { createClient } from '@supabase/supabase-js'; // Initialize Supabase client const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; if (!supabaseUrl || !supabaseAnonKey) { console.error('❌ Variables d'environnement Supabase manquantes'); throw new Error('VITE_SUPABASE_URL et VITE_SUPABASE_ANON_KEY sont requis'); } const supabase = createClient(supabaseUrl, supabaseAnonKey);
BE_PMAinc
BE_PMAincOP2w ago
I changed the file to txt so I could add it here.
silentworks
silentworks2w ago
This is why I said having some knowledge of how the underlying technologies work will help.
BE_PMAinc
BE_PMAincOP2w ago
Yeah we all start somewhere, Im starting. ok so I need to add "%" for some reason... sounds to me this could easily be simplified with a dumb proof UI.
silentworks
silentworks2w ago
Which part of this file do you want me to take a look at?
BE_PMAinc
BE_PMAincOP2w ago
Supposebly, this is all the code that fetch the "dashboard.title" from the database but it doesnt work.
silentworks
silentworks2w ago
The UI is exactly what a database UI should be like. Changing this behaviour would be breaking it for anyone who understands how databases should work.
BE_PMAinc
BE_PMAincOP2w ago
Eventually, everything will be simplified, and thats why people are switching to AI... so they dont have to type "%" when they want to find a row with a word part of an entry.
silentworks
silentworks2w ago
Are you getting to any of the console.log's inside of the i18n file?
BE_PMAinc
BE_PMAincOP2w ago
yes got it here, 2sec Clé manquante: dashboard.subtitle (translation:fr) missingKeyHandler @ i18n.ts:95 send @ i18next.js?v=c48ac005:644 translate @ i18next.js?v=c48ac005:662 t @ i18next.js?v=c48ac005:2226 fixedT @ i18next.js?v=c48ac005:2214 Dashboard @ Dashboard.tsx?t=1755191086740:31 renderWithHooks @ chunk-WRD5HZVH.js?v=d58279d8:11548 updateFunctionComponent @ chunk-WRD5HZVH.js?v=d58279d8:14582 beginWork @ chunk-WRD5HZVH.js?v=d58279d8:15924 beginWork$1 @ chunk-WRD5HZVH.js?v=d58279d8:19753 performUnitOfWork @ chunk-WRD5HZVH.js?v=d58279d8:19198 workLoopSync @ chunk-WRD5HZVH.js?v=d58279d8:19137 renderRootSync @ chunk-WRD5HZVH.js?v=d58279d8:19116 performSyncWorkOnRoot @ chunk-WRD5HZVH.js?v=d58279d8:18874 flushSyncCallbacks @ chunk-WRD5HZVH.js?v=d58279d8:9119 flushSync @ chunk-WRD5HZVH.js?v=d58279d8:18959 scheduleRefresh @ chunk-WRD5HZVH.js?v=d58279d8:20004 (anonymous) @ @react-refresh:188 performReactRefresh @ @react-refresh:180 (anonymous) @ @react-refresh:474 setTimeout (anonymous) @ @react-refresh:465 validateRefreshBoundaryAndEnqueueUpdate @ @react-refresh:512 (anonymous) @ Dashboard.tsx:104 (anonymous) @ client:34 (anonymous) @ client:218 (anonymous) @ client:193 queueUpdate @ client:193 await in queueUpdate (anonymous) @ client:638 handleMessage @ client:636 (anonymous) @ client:546 dispatchEvent @ .webcontainer@runtime.96435430.js:26 _handleMessage @ .webcontainer@runtime.96435430.js:26 _0x4a5968.<computed> @ .webcontainer@runtime.96435430.js:26Understand this warning i18next::translator: missingKey fr translation test.verification test.verification it says missing key
silentworks
silentworks2w ago
And therein lies the problem, everyone thinks AI is a solution to every problem whilst AI hallucinates more than anything else. Good luck with this pipe dream.
BE_PMAinc
BE_PMAincOP2w ago
I understand your point, but Im pretty sure we are heading that way, obviously Im not a programmer. Yet I made a complete fonctional game using AI.
silentworks
silentworks2w ago
I can't see that message anywhere in the file you shared. Is any of the console.logs getting printed to your terminal. This will be the easiest way to find where the issue starts at.
BE_PMAinc
BE_PMAincOP2w ago
Its from the console in the browser, you are asking about the line doing that check?
silentworks
silentworks2w ago
The console.log's I'm referring to is in the code you shared, if you look you will see a bunch of console.log written in it with some messages, if we can figure out which was the last one that got called then we can zone in on where the issue might be.
BE_PMAinc
BE_PMAincOP2w ago
The last console log is "Clé manquante: dashboard.underConstruction.comingSoon (translation:fr) missingKeyHandler @ i18n.ts:129..." Maybe we could do a share screen it you could guide me to exactly what you need. There are MANY missing keys supposedly, despite some of them definitely existing in the database, especially the main example being "dashboard.title"
silentworks
silentworks2w ago
Is this being printed in your console? console.log(✅ ${data.length} traductions chargées pour ${namespace});
BE_PMAinc
BE_PMAincOP2w ago
Chargement des traductions: fr/translation i18n.ts:27 🔄 Chargement des traductions: fr/common i18n.ts:27 🔄 Chargement des traductions: fr/navigation i18n.ts:27 🔄 Chargement des traductions: fr/fileUpload i18n.ts:27 🔄 Chargement des traductions: fr/forms i18n.ts:27 🔄 Chargement des traductions: fr/tables i18n.ts:27 🔄 Chargement des traductions: fr/article i18n.ts:27 🔄 Chargement des traductions: fr/client i18n.ts:27 🔄 Chargement des traductions: fr/company i18n.ts:27 🔄 Chargement des traductions: fr/employee
BE_PMAinc
BE_PMAincOP2w ago
✅ 44 traductions chargées pour translation 18next::backendConnector: loading namespace navigation for language fr failed failed loading /locales/fr/navigation.json; status code: undefined
silentworks
silentworks2w ago
So it's saying there are some keys missing, are those keys in your database?
BE_PMAinc
BE_PMAincOP2w ago
see the reply from " — 13:20" for the supabase screenshot showing the entry and this screenshot for the result :
No description
silentworks
silentworks2w ago
This doesn't have anything to do with the key being there or not as the i18n plugin is what handles these. Are there more than 1000 entries in the translations table?
BE_PMAinc
BE_PMAincOP2w ago
723 records it needs to be optimised, many duplicated values so what you are saying is that its incorrectly handling the test?
silentworks
silentworks2w ago
After this bit of code
// Query Supabase for translations
const { data, error } = await supabase
.from('translations')
.select('key, value')
.eq('lang', language)
.eq('namespace', namespace);
// Query Supabase for translations
const { data, error } = await supabase
.from('translations')
.select('key, value')
.eq('lang', language)
.eq('namespace', namespace);
write a
console.log(`Translations: ${data.length}`)
console.log(`Translations: ${data.length}`)
and see what the length number is. If this length doesn't show 723, then it's not getting every record in your database. If it does then the issue is elsewhere in your code.
BE_PMAinc
BE_PMAincOP2w ago
understood, on it.
silentworks
silentworks2w ago
Actually wait what I said is incorrect as it has a .eq filter on it
BE_PMAinc
BE_PMAincOP2w ago
that debug log is framented into 91 logs. I dont get the total. Let me fix it, unless you can write it quickly.
silentworks
silentworks2w ago
Yeah that was incorrect, Let me provide a more updated code to the effect of what I'm trying to do. Add this right after the try { in your code on the next line
/* beginning of testing code */
// Query all translations from Supabase
const { data, error } = await supabase
.from('translations')
.select('key, value');
console.log(`All Translations: ${data.length}`);
/* end of testing code */
/* beginning of testing code */
// Query all translations from Supabase
const { data, error } = await supabase
.from('translations')
.select('key, value');
console.log(`All Translations: ${data.length}`);
/* end of testing code */
silentworks
silentworks2w ago
Here is a screenshot incase it's not clear where to put it from my above message
No description
BE_PMAinc
BE_PMAincOP2w ago
723 723 records so they are all charged
silentworks
silentworks2w ago
Ok so the query is getting all the data from your database The issue is elsewhere in your code You can remove that bit of code I asked you to add now You should tell AI that the i18n isn't picking up some keys and ask it to fix the issue.
BE_PMAinc
BE_PMAincOP2w ago
yeah indeed... its a mess, maybe I should remove all the .json bits and fallback. Thank you for trying to help.
silentworks
silentworks2w ago
No problem. I hope you get it resolved soon.
BE_PMAinc
BE_PMAincOP2w ago
Pass my feedback about that filter to the devs. 😉
silentworks
silentworks2w ago
Also remember to re-enable RLS on your table, you don't want to leave that disabled as someone can delete all records from that table.
BE_PMAinc
BE_PMAincOP2w ago
done !
silentworks
silentworks2w ago
I'm not a Supabase staff and I like the filter the way it is 😁
BE_PMAinc
BE_PMAincOP2w ago
I have no doubt about that ! 😆
silentworks
silentworks2w ago
You are now my vibe coder friend for life 😁
BE_PMAinc
BE_PMAincOP2w ago
Ahaha nice ! 🏆

Did you find this page helpful?