Jump to content

Datastore Error?


Recommended Posts

Hey, I just got this error with my datastores. I don't know what caused it since it has worked flawlessly before. It sometimes works but more often than not it gives me an error. Does anyone know how to fix this error and what is causing it? Here is the error from the output.

502: API Services rejected request with error: HTTP 0 (HTTP 500 (HTTP/1.1 500 Internal Server Error))

Can somebody please help me out here? Thanks in advance!

Share this post


Link to post
Share on other sites

When an http request is sent (in this case your data store request), it sends back a status code. In this case, it's 500. In general, any code in the form 5xx is an internal server error (already mentioned in the error message)  and isn't your issue to fix. The best you can do is safely catch all errors that are thrown from the datastore request with pcall() and handle such occurrences appropriately.

Edited by RayCurse

Share this post


Link to post
Share on other sites

Alright, thanks! I thought it would be something like that but tried fixing it anyway. And somehow it just stopped when I put a wait() before calling the :GetAsync()  Although that might just have been a coincidence that it worked then. Anyway thanks, now I know!

Share this post


Link to post
Share on other sites
  • 1 month later...

I would suggest pcalling as well(if you aren't already) and using the status to determine whether or not give the player temporary yet playable data. That way when you have problems you cannot control you could at least allow the player to still play by some means, of couse prompting them that the data is temporary as well. This will make sure that while these problems are happening not only is saving blocked, but the data is still playable, allowing your game not to die in the process.

Share this post


Link to post
Share on other sites
  • 4 months later...

Pcalling is a life saver for datastores and stuff like that. Before I was doing weird stuff.

E.g. cash.Value = cashdata:GetAsync(plr.userId) or 0

But now that I know the proper way(pcall) it stopped most errors. Hope this can help!

Share this post


Link to post
Share on other sites
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.