Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

502 Bad Gateway error when uploading large backups (6016.2 MB) #206

Open
Selim042 opened this issue May 24, 2023 · 5 comments
Open

502 Bad Gateway error when uploading large backups (6016.2 MB) #206

Selim042 opened this issue May 24, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Selim042
Copy link

Selim042 commented May 24, 2023

Describe the bug
My automatic backups that execute weekly fail to upload and when I try to manually upload them I get a 502 Bad Gateway error:
Fail to upload snapshot to nextcloud (HTTPError: Response code 502 (Bad Gateway)) !

To Reproduce
Create a large backup, in my case 6016.2 MB and attempt to upload it to Nextcloud.

Expected behavior
The backup to upload to Nextcloud without error.

System information

  • Home Assistant Version: 2023.5.4
  • Home Assistant Supervisor Version: 2023.04.1
  • Nextcloud Version: 26.0.1
  • Addon version: 0.17.7
  • If any, reverse proxy in front of Nextcloud: Apache2

Additional context
Smaller backups upload without issue.
When downloading the backup to a different device and uploading it from there, either via desktop sync or via the browser, the backup uploads without issue.

@Selim042 Selim042 added the bug Something isn't working label May 24, 2023
@JvdBBBB
Copy link

JvdBBBB commented Jul 5, 2023

I have the same issue. Is it possible to make the addon upload the backup in smaller chunks?

@Shariner
Copy link

Shariner commented Jul 11, 2023

Nearly the same issue. 1420MB backup, uploaded "successfully" to nextcloud with the size of 0 KB.

[2023-07-11 13:58:27] [info]: ...Upload finish ! (status: 201)

@Shariner
Copy link

Shariner commented Aug 9, 2023

I recommend everyone to read issue #9 and issue #123

For nextcloud you have to configure php settings:

upload_max_filesize=256G
post_max_size=256G

Explanation:
In this example it's set to 256 GB, choose whatever you want. )

if nextcloud is running at nginx you have to set
client_max_body_size 0

if nextcloud is running at apache2 you have to set
LimitRequestBody 0
FcgidMaxRequestLen 1073741824

Explanation:
LimitRequestBody 0 disables the Limit
FcgidMexRequestLen is set in Bytes. In this example 5GB.

As I am running nextcloud at apache2, I confirm these settings for uploading backups to nc with a size up to 5GB. It could be, that the FcgidMaxRequestLen is also missing at nginx servers or has a very similar setting. Check your apache2/Nginx logs, they are very helpful. In my case, the usual upload max request lenght was set to 1GB. Now it's set to 5GB.

Uploads via frontend and/or client is not the same way as uploading via your HA instance, as the frontend chunks bigger uploads and the client uses a different connection type.

The addon is working, if nextcloud has the correct settings - i bet that's a solution for most of the open issues in this repo.

@Selim042
Copy link
Author

I already had the php settings and have added the apache2 settings. No change.

@Sebclem
Copy link
Owner

Sebclem commented Jan 18, 2024

This can be fixed with chunked upload (#205) I'm still working on it #192.

There was a huge time of inactivity on this repos because of personal reason, but now I'll try to get back to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants