I have followed each step, I can connect to my local sqlite3 file and add fields and data within the Wappler database manager.
However, when I create a simple query I get
{"status":"500","code":"SQLITE_ERROR","message":"select * from mytable - SQLITE_ERROR: no such table: mytable","stack":"Error: select * from mytable - SQLITE_ERROR: no such table: mytable"}
Are you sure you applied the changes in the database manager if the table was created there?
Are you using a local target with NodeJS exactly as explained in the docs?
Everything looks correct.
Can you try restarting (full quit and restart) Wappler and reapply the connection in the database manager? And save your server action again after that / or recreate the query.
Sqlite is not case-sensitive, so mytable and myTable would both point to the same table. The error says that it canât find the table, so it doesnât exist in the database. Sqlite is a very simple database that stores all data in a single file, you probably pointed the direct database connection for the database manager to a different location then the database connection used in server connect.
I started again, with a new test database, new test table, new server action running a database query (select* from test)
When opening server action in browser I got:
{"status":"500","message":"path.toSystemPath: Invalid path \"test\".","stack":"Error: path.toSystemPath: Invalid path \"test\".\n at toSystemPath (/opt/node_app/lib/core/path.js:30:19)\n at App.setDbConnection (/opt/node_app/lib/core/app.js:246:43)\n at App.getDbConnection (/opt/node_app/lib/core/app.js:268:25)\n at App.select (/opt/node_app/lib/modules/dbconnector.js:14:25)\n at App._exec (/opt/node_app/lib/core/app.js:435:57)\n at App.exec (/opt/node_app/lib/core/app.js:375:20)\n at App.define (/opt/node_app/lib/core/app.js:365:20)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
the .sqllite3 file needed to be in the public folder and then it worked as expected.
Iâve tried setting up an SQlite and I get a similar 500 error (although the SQLITE_CANTOPEN error).
{"status":"500","code":"SQLITE_CANTOPEN","message":"SQLITE_CANTOPEN: unable to open database file","stack":"Error: SQLITE_CANTOPEN: unable to open database file"}
Iâve.
restarted wappler.
created a brand new sqlite file
created a new workflow using the new sqlite file.
Still same error.
As Teodor said though, canât keep the db in the public folder. I have mine in server/db.sqlite at the root.
The DB file MUST be in the root directory. Not in a folder of the root directory.
But now despite that, despite recreating the db 5 times, adding a single table and a record. (and the table existing), I get the same error as you do.
{"status":"500","code":"SQLITE_ERROR","message":"select id, urlfromseo_metalimit 1 - SQLITE_ERROR: no such table: seo_meta","stack":"Error: selectid, urlfromseo_meta limit 1 - SQLITE_ERROR: no such table: seo_meta"}
A very odd one.
âedit.
Still looking into this. The database has been created properly and the tables do exist. Opened the file using DB Browser for SQlite.
Can you please check both server connect connection and database manager connection - do they both point to the same location? Can you share screenshots of both please?
I thought that as well that maybe something was corrupted. So deleted it (manually), deleted from everywhere. Then created it again using DB Manager which automatically created the DB connection in Workflows.
You are using Docker and that has only access to some specific folders. Easiest way to get it working for now is to place your database in the app folder.