Next.js Discord

Discord Forum

Issues with Libsql and Env.

Answered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
const client = createClient({
    url: "libsql://db.turso.io",
    authToken: process.env.DBAUTHB!,
});


everything works perfectly but I get an error that doesnt mean any failure to the site but it always show at a corner, saying the following:

Unhandled Runtime Error
LibsqlError: SERVER_ERROR: Server returned HTTP status 401

Source
db\index.ts (70:25) @ async getProducts
> 70 |         const results = await finalQuery.all();
     |                         ^
  71 |         return results;
  72 |     } catch (error) {




this only shows when i try to add the env for the token, once I remove it and add it, well, exposed this warning shows no more at the corner.
anybody knows what might be wrong?
Answered by Masai Lion
and fetch it on client
View full answer

11 Replies

Masai LionOP
Bump 🙂
Masai LionOP
Bump 😦
Masai LionOP
BUMP
does console.log(process.env.DBAUTHB!) return something?
i fixed it i think so
i did an api that handles product fetch
and then sorts
instead of doing it from the db initialize file
i do it from an api route
Masai LionOP
and fetch it on client
Answer