My app works when I test it on replit but when I deploy it it stops working

Question:

Repl link/Link to where the bug appears:
https://replit.com/@JavisthChabria/ReplaceBG?v=1

Screenshots, links, or other helpful context:
This is the deployed page: https://replace-bg-jvlabs.replit.app/

code snippet

Hello, @JavisthChabria, welcome to Replit Ask!

Can you please elaborate on the problem a little bit more? You could also send screenshots of the problem you are experiencing too so we can help you more easily.

So essentially it’s an app comprising of a Flask backend and HTML/JS frontend. I use a webcap to capture the image of a person and I replace the background in the backend and serve it to the front end. While I test the app on replit, everything works. But after I deploy it, the background replacement on the backend sends a 500 error and I don’t understand why.

Hey @JavisthChabria!

Does that backend processing write to a file? If so then that’s the cause of your issue, as there is currently no way to have persistent files in deployments.

2 Likes

I think the issue happens in my fetch command in my my html when deployed. It works locally because it fetches from a relative path. I’m not sure if this path needs to be changed when deployed online

You mentioned you get an image from the user correct? Do you save that into the filesystem and try to return it? If so, then that is exactly why your code won’t work, because deployments cannot save stuff/edit stuff in their file systems.

1 Like

What can I do to solve this?

There is nothing you can do at this time, besides using some external storage service. Replit Staff have said they are working on a solution however.

I don’t have a timeline to share, but can confirm we’re actively working on a solution. Hope to see it soon.

2 Likes