Backup upload failing

AI-generated summary

The discussion revolves around a backup upload failing issue on a Discourse site configured to use a subfolder. The problem arises because the upload function does not respect the DISCOURSE_RELATIVE_URL_ROOT value, resulting in an invalid path.

@tim.smith initially reported the issue and managed to work around it by uploading the backup as an attachment, then manually moving and renaming it. However, this solution is not feasible for their production instance due to lack of SSH access.

@codinghorror suggested that there might be a bug with the subfolder logic, which was acknowledged by @zogstrip. After an initial delay, @zogstrip provided a fix for the issue, committing the changes to GitHub (https://github.com/discourse/discourse/commit/68c158d5920ffcb76655d928fb80f5ca28c8d19d). Another user, @nckackerman, also reported experiencing the same issue and inquired about progress on a fix.

I’m trying to restore my discourse site, but I can’t upload backups. It eventually fails with a 500 error (though that’s probably irrelevant).

The JavaScript console is showing that it’s trying to post to Login | HSTS Redirection Community. The issue with this is that the path isn’t valid. The site is configured to use a subfolder per these instructions: Serve Discourse from a subfolder (path prefix) instead of a subdomain. It looks like the upload function isn’t respecting that and is leaving out the value specified in DISCOURSE_RELATIVE_URL_ROOT.

I’m not currently able to manually upload files to the server (AWS EC2 instance with lots of security). The site is also configured to use S3 for backups, but Discourse doesn’t see the backups uploaded manually to S3. Discourse doesn’t see any of the backups after resetting the EC2 instance.

Does anyone have any ideas how to fix this? My discourse instance is completely broken until I can load a backup.

Update:
I was able to work around the alleged bug and my limitations by turning of S3 config, uploading the backup as an attachment to a post, SSHing into the server to copy it from the uploads folder to the backups folder, renaming to its original name, and then it showed on the backups page and I could click the button to restore that backup.

The original issue remains, however. This is still a blocker for me as I do not have SSH access to the prod instance to move and rename the file.

@zogstrip is there a bug with subfolder logic here?

I will have a look, pretty sure I haven’t tested that use case :frowning:

Have you been able to track this down?

I have run into this issue as well. Has any progress been made here? Can we expect a fix?

Sorry about the delay. Here’s the fix :rotating_light:

https://github.com/discourse/discourse/commit/68c158d5920ffcb76655d928fb80f5ca28c8d19d