Ask coding questions

← Back to all posts
repl db in console projects (change my mind)
h
ch1ck3n

@MrVoo thinks that repl DB only works in web projects, not console projects

as seen in the repl below, repl DB works perfectly fine in most console project of console projects. For whatever reason, @mrvoo 's extremely stubborn self refuses to believe the truth and claims that he had tried to use repl DB in one of his console projects but failed.

Is there a reason that this repl works but mrvoo's doesn't? Is it some sort of weird security issue that repl db doesn't work in some cases?

https://replit.com/talk/share/RishiMohanty-ch1ck3n-This-project-does/146704/566148

Voters
ch1ck3n
Comments
hotnewtop
Coder100

both of you are wrong. Your repl is wrong because the replit db key is private to you, so console projects won't be able to use replit db. However, you could just make it a web project:

create a web server API which your console posts to!

ch1ck3n

@Coder100

both of you are wrong

(•ˋ _ ˊ•)

Spacecraft

The ReplitDB works fine in the console as long as you are the only one reading or making changes to the database. When other users run the same REPL, they are assigned their own unique, empty, database. So, for your example above, you created a database entry called 'poop'. This works fine for you, but when the rest of us run it, our unique empty database has no such entry, so your code fails.

Spacecraft

This is also the output when I run your REPL:

ch1ck3n

@Spacecraft ok i figured out why its not working for you. there is a private key for every repl db. that key is stored in secrets (called REPL_DB_URL) and unless you are the repl owner you can't access it. since there is no poop value in this empty db you cant access it.

Spacecraft

@ch1ck3n Yeah, I'm pretty sure that's what I said in my original reply, right?

MrVoo

I'm not insane I promiiiiiiiise

ch1ck3n

@MrVoo ok i figured out why its not working for you. there is a private key for every repl db. that key is stored in secrets (called REPL_DB_URL) and unless you are the repl owner you can't access it. since there is no poop value in this empty db you cant access it.