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

Supervisor api returning (HTTPError: Response code 400 (Bad Request)) ! #102

Closed
fifisoft57 opened this issue Jan 13, 2022 · 15 comments
Closed
Labels
bug Something isn't working

Comments

@fifisoft57
Copy link

Hello

I installed this addon to make automatic backups as I did on jeedom.

the first test we were ok in manual, after I schedule a backup every day at 3:00 am, and I look at the logs and I see this error:

Error
Fail to start addons (HTTPError: Response code 400 (Bad Request))!

So I look at my nextcloud account if all goes well, and no problem the account works, I redo a password in case, and always the same error, I restart HA and always the same error:

here are the logs:

System information

System Health

version core-2021.12.9
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.7
os_name Linux
os_version 5.10.88
arch x86_64
timezone Europe/Paris
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4810
Installed Version 1.19.3
Stage running
Available Repositories 996
Downloaded Repositories 15
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 7.1
update_channel stable
supervisor_version supervisor-2021.12.2
docker_version 20.10.9
disk_total 31.3 GB
disk_used 8.0 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons ESPHome (2021.12.3), File editor (5.3.3), Samba share (9.5.1), Terminal & SSH (9.3.0), Home Panel (2.3.3), Nextcloud Backup (0.16.4)
Lovelace
dashboards 1
resources 7
views 6
mode storage
- Nextcloud Version : Nextcloud Hub II (23.0.0) - Addon version : Current version: 0.16.4
@fifisoft57 fifisoft57 added the bug Something isn't working label Jan 13, 2022
@Sebclem
Copy link
Owner

Sebclem commented Jan 13, 2022

Hi, do you have any checked add-on inside Auto stop add-on ?

@xxgmxx
Copy link

xxgmxx commented Jan 16, 2022

Hi guys I am getting also code 400, I have been using it for months, auto backups every day. The last backup was 1.1.2022, since this last update I am getting "Can't create new snapshot (Response code 400 (Bad Request))" Which is inside the addon in the status tab. I have checked the password, username and everything is right. I have no autostop add-ons. Cant make it work again.

@Sebclem
Copy link
Owner

Sebclem commented Jan 16, 2022

@xxgmxx, do you have any error in your supervisor logs ? (Not the addon logs but supervisor one)

@Sebclem
Copy link
Owner

Sebclem commented Jan 16, 2022

Something change with the authentication method in the supervisor API, it's maybe related to this.

But it's very strange because I don't have this issue with my setup.
Anyway, I will try to find some time Monday to try to fix this

@xxgmxx
Copy link

xxgmxx commented Jan 16, 2022

@Sebclem I do not see any error in the supervisor log. I did try to set the "Auto Clean Nextcloud Backups" to a lower amount than I had before and it deleted the old backups successfully. If it had no access to NC it would not delete it, so there is something different wrong. I tried to make another backup from the addon, and it keep "waiting" and waiting for more than 45min now.

@fifisoft57
Copy link
Author

Hello everyone

to solve the problem, I had to uninstall the add-on then reinstall it, it worked for 4 saves and then the error came back

@jappish84
Copy link

I'm having this issue aswell. I have tried reinstalling, and manage to get a few uploads to nextcloud, but then it fails with the error message. Another thing is that recently it seems to crash Home assistant while in the end stage of uploading. Home assistant becomes unresponsive and reboots. Supervisor logs are not super helpful:

22-01-24 14:09:45 INFO (MainThread) [supervisor.api.middleware.security] /snapshots access from 229cc4d7_nextcloud_backup 22-01-24 14:09:50 INFO (MainThread) [supervisor.api.middleware.security] /snapshots access from 229cc4d7_nextcloud_backup 22-01-24 14:09:55 ERROR (MainThread) [supervisor.api.ingress] Ingress error: [Errno 104] Connection reset by peer

@Sebclem Sebclem changed the title Error Fail to start addons (HTTPError: Response code 400 (Bad Request)) ! Supervisor api returning (HTTPError: Response code 400 (Bad Request)) ! Jan 24, 2022
@Sebclem
Copy link
Owner

Sebclem commented Jan 24, 2022

Hello everyone,

I have create a new version with the new auth method for the hassio api.
I also use the new snapshot/backup url (snapshots/ => backups/).

Finally, I have temporary disabled the home assistant entities, I have found that my implementation flood the core api, I think this is the issue you are experiencing @jappish84 when HA is not responding. I need to find some times to rebuild this.

So, if you can try this new version and tell me is this is getting better, thanks.

EDIT: Don't forget to change the log level to debug in the addon config

@jappish84
Copy link

Thank you for a fast response @Sebclem

I have now updated to the latest release and pushed for a manual update and everything seems to be working as expected again. Will make sure to report back if I find any further issues. Thanks a lot and keep up the great work, much appreciated! :)

@amanaedk
Copy link

I just tried to use this today and got this error. The log file has:

[2022-01-27 22:46:50] [info]: 	Starting Cron...
[2022-01-27 22:47:03] [info]: 	Stopping addons...
[2022-01-27 22:47:03] [info]: 	... Ok
[2022-01-27 22:47:03] [info]: 	Creating new snapshot...
[2022-01-27 22:47:11] [info]: 	Snapshot created with id 7035fb13
[2022-01-27 22:47:11] [info]: 	Downloading snapshot 7035fb13...
[2022-01-27 22:47:11] [info]: 	Download success !
[2022-01-27 22:47:11] [info]: 	Uploading snap...
[2022-01-27 22:47:12] [info]: 	Upload done...
[2022-01-27 22:47:12] [info]: 	Upload done...
[2022-01-27 22:47:23] [error]: 	Fail to upload snapshot to nextcloud (HTTPError: Response code 400 (Bad Request)) !
[2022-01-27 22:47:23] [error]: 	HTTPError: Response code 400 (Bad Request)
    at Request._onResponseBase (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:899:31)
    at Request._onResponse (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:934:24)
    at ClientRequest.<anonymous> (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:948:23)
    at Object.onceWrapper (events.js:520:26)
    at ClientRequest.emit (events.js:412:35)
    at ClientRequest.origin.emit (/opt/nextcloud_backup/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:515:22)
    at TLSSocket.emit (events.js:400:28)
(node:346) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (HTTPError: Response code 400 (Bad Request)) !
(node:346) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 14)

@xxgmxx

This comment was marked as off-topic.

@Sebclem
Copy link
Owner

Sebclem commented Feb 15, 2022

@xxgmxx please take a look at this: #111 (comment)

@xxgmxx
Copy link

xxgmxx commented Feb 16, 2022

So I increased the timeout that caused the "Can't create new snapshot (Timeout awaiting 'request' for 5400000ms)" and the manual snapshot was created, but while the auto snapshot I got this error.

[2022-02-15 18:14:34] [info]: Log level: info
[2022-02-15 18:14:34] [info]: Backup timeout: 54000000
[2022-02-15 18:14:34] [info]: Satus : Go !
[2022-02-15 18:14:34] [info]: Initializing and checking webdav client...
[2022-02-15 18:14:34] [info]: Starting auto clean cron...
[2022-02-15 18:14:35] [info]: Starting Cron...
[2022-02-15 18:14:35] [info]: Hassio API : Go !
[2022-02-15 18:14:35] [info]: Nextcloud connection : Go !
[2022-02-15 18:14:42] [info]: Stopping addons...
[2022-02-15 18:14:42] [info]: ... Ok
[2022-02-15 18:14:42] [info]: Creating new snapshot...
[2022-02-15 22:14:35] [info]: Snapshot created with id 99b6a5fb
[2022-02-15 22:14:36] [info]: Downloading snapshot 99b6a5fb...
[2022-02-15 22:17:11] [info]: Download success !
[2022-02-15 22:17:11] [info]: Uploading snap...
[2022-02-15 22:26:45] [info]: Upload done...
[2022-02-15 22:26:46] [info]: ...Upload finish ! (status: 201)
[2022-02-15 22:26:46] [info]: Starting addons...
[2022-02-15 22:26:46] [info]: ... Ok
[2022-02-15 22:26:46] [info]: Cloud clean done.
[2022-02-16 01:00:00] [info]: Cloud clean done.
[2022-02-16 02:00:00] [info]: Stopping addons...
[2022-02-16 02:00:00] [info]: ... Ok
[2022-02-16 02:00:00] [info]: Creating new snapshot...
[2022-02-16 02:00:00] [error]: Can't create new snapshot (Response code 400 (Bad Request))
(node:353) UnhandledPromiseRejectionWarning: Can't create new snapshot (Response code 400 (Bad Request))
(Use node --trace-warnings ... to show where the warning was created)
(node:353) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:353) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@Sebclem
Copy link
Owner

Sebclem commented Feb 16, 2022

Ok I have found something interesting. If you try to create a backup (here with the addon ), but, if HA is already generating a backup, the supervisor API return you a 400 (Bad Request).

Did you have any backup creation pending during your test ? Like another backup addon or a manually triggered one ?

@xxgmxx
Copy link

xxgmxx commented Feb 22, 2022

I have to say, that for me it was probably caused by HA generating a backup while NC Backup also tried to create a backup, or rather another addon (samba backup) starting backup while NC backup was in process of backuping. The last 4 days are all successfully uploaded and NC backup is waiting for the next backup. Thank you for suggesting this.

@Sebclem Sebclem closed this as completed Jun 27, 2022
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

5 participants