Replit DB not saving across different devices

Problem description:
If you play a game that saves data via replit db. Your data is obviously saved, but only on that device; if you switch to another device, you’ll have to start over, even if you’re on the same account where the data was previously saved.

Expected behavior:
Save the replit db data for when a user logs in on a different device.

Actual behavior:
Resets data and makes user start over.

Steps to reproduce:

  • Login to your replit account via a different device
  • Open a game you have data (Replit DB) on.
  • Start it and you will notice all your data was reset.

Bug appears at this link:
all games that uses Replit DB

Browser/OS/Device:
I don’t know at the top of my head.

1 Like

Being an across device issue makes no sense to me, it seems more likely that your database just isn’t persisting? Any chance you can give us a Repl to play around with?

How am I supposed to demonstrate this with a repl? I’m saying if you play a game that saves data via replit db on your main device. When you switch to a different device, your data will not transfer, and the game will reset and force you to start over, even if you are still playing on the same account you were using before switching devices.

1 Like

Yeah, do you have a Repl I can test this out on? A Repl that does something with the DB, so I can try it out on multiple devices.

I’ve just seen that other topic about the insecurity of the DB, I believe the solution has always been that you need to host your Repl (as in use some sort of web server) for the DB to persist in a predictable, expected, manner.

Yes, I do:

test repl

If you run the repl once and run it again (so it can save your user in the db) it should return “welcome back @MattDESTROYER”, now you go on a different device and run it if this message does not appear it will say your data was reset. Which in return proves this bug exists and should be looked at.

1 Like

Interesting, like I said, however, being a cross-device issue makes no sense to me, I would be more inclined to believe it’s something else like to do with different browsers maybe caching or something I dunno (but that wouldn’t make sense either since the browser never directly accesses the db… I dunno).

Previously, as I said earlier, the solution has just been to add a web server which I tested here and it worked.

Bumping this topic b/c issue still persists & I believe it should be looked at.

The test does not work (404). Have you tried doing website? Note that I found out with @Firepup650 that the repl on the cover page is different than your actual repl. (It is a random one with a gibberish slug) that might be causing your issue.

1 Like

This topic was from 2 months ago, I deleted that test repl long ago.

I mean like terminal games, etc. For example if I play one of @OverdriveReplit terminal games and got 15k coins it would save & if I reloaded the game my stuff will be there, but if I switch to a different device on the same account and tried to play that game my data will be reset.

2 Likes

There’s some confusion about how replit db works so I’ll put my thoughts:
Basically, for console repls, replit will do a temp ghost fork of the repl that gets deleted afterwards, as with all forked repls, the env vars (including the REPLIT_DB_URL) change. Therefore, everytime you fork, I believe that what happens is that replit keys the fork id to your user id as well as the repl to ensure that the same REPLIT_DB_URL gets generated or smth (lol or it’s just localStorage, actually it’s probably that), anyway, if you are on a different device, either the fork generation depends on the device or it’s dependent on localStorage I’d bet on localStorage so that can’t really be solved

2 Likes

I viewed the localStorage and it basically has everything even previous repl’s I deleted.

2 Likes

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