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

Fail to upload snapshot to nextcloud (RequestError: URI malformed) #32

Closed
poudenes opened this issue Nov 17, 2020 · 19 comments
Closed

Fail to upload snapshot to nextcloud (RequestError: URI malformed) #32

poudenes opened this issue Nov 17, 2020 · 19 comments
Labels
bug Something isn't working

Comments

@poudenes
Copy link

Since update I get this error:

Nextcloud: Current version: 0.11.1
HA: 0.117.6

[2020-11-17 12:42:05] [error]: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:252) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:252) 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)
(node:252) [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.
@poudenes poudenes added the bug Something isn't working label Nov 17, 2020
@Sebclem
Copy link
Owner

Sebclem commented Nov 17, 2020

This can be an issue with setting.
Can i have the value of the fallowing settings:

  • Backup name (in Backup Settings)
  • Backup Directory (in Nextcloud Settings)

@poudenes
Copy link
Author

poudenes commented Nov 17, 2020

Nextcloud Settings:
/Backup/hassio backup/

Backup Settings:
Nextcloud-{type}-{ha_version}-{date}_{hour}

I changed the /Backup/hassio backup/ to /Backup/hassio_backup/

@Sebclem
Copy link
Owner

Sebclem commented Nov 17, 2020

Can i have the full log ?

@poudenes
Copy link
Author

Removed the tool. Restart HA and reinstalled the tool again. This is the first log file before i configure everything:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 10-run: applying... 
[fix-attrs.d] 10-run: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[14:54:55] INFO: Starting Node...
> nexcloud-backup@0.8.0 start /opt/nextcloud_backup
> node --inspect=0.0.0.0:9226 ./bin/www 
Debugger listening on ws://0.0.0.0:9226/b4a81672-e445-4266-9954-4ac9c087441a
For help, see: https://nodejs.org/en/docs/inspector
[2020-11-17 15:54:58] [info]: Satus : Go !
[2020-11-17 15:54:58] [error]: Nextcloud config not found !
[2020-11-17 15:54:58] [warn]: Bad value for cron settings, fallback to default 
[2020-11-17 15:54:58] [warn]: Bad value for 'name_template', fallback to default 
[2020-11-17 15:54:58] [warn]: Bad value for 'auto_clean_local_keep', fallback to 5 
[2020-11-17 15:54:58] [warn]: Bad value for 'auto_clean_backup_keep', fallback to 5 
[2020-11-17 15:54:58] [warn]: Bad value for 'auto_clean_local', fallback to false 
[2020-11-17 15:54:58] [warn]: Bad value for 'auto_clean_backup', fallback to false 
[2020-11-17 15:54:58] [info]: Starting auto clean cron...
[2020-11-17 15:54:58] [warn]: No Cron settings available.
[2020-11-17 15:54:58] [error]: Nextcloud connection : FAIL !
[2020-11-17 15:54:58] [error]: ... Nextcloud config not found !
[2020-11-17 15:54:58] [info]: Hassio API : Go !

After i add all info to connect to the nextcloud server this is the log part:

[2020-11-17 15:57:11] [info]: Initilizing and checking webdav client...
[2020-11-17 15:57:13] [debug]: Nextcloud connection:  Success !
[2020-11-17 15:57:15] [debug]: Path /Backup-Hassio/ already exist.

It created the 2 folders Auto and Manual.
Started manual a backup and this is the result:

[2020-11-17 15:59:01] [warn]: No Cron settings available.
[2020-11-17 15:59:06] [info]: Creating new snapshot...
[2020-11-17 16:06:01] [info]: Snapshot created with id 5a677835
[2020-11-17 16:06:01] [info]: Downloading snapshot 5a677835...
[2020-11-17 16:06:02] [debug]: Snapshot size: 299.3
[2020-11-17 16:06:13] [info]: Download success !
[2020-11-17 16:06:13] [debug]: Snapshot dl size : 299.296875
[2020-11-17 16:06:13] [info]: Uploading snap...
[2020-11-17 16:06:13] [error]: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:251) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:251) 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: 7)
(node:251) [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 Nov 17, 2020

I have made a new release with more debug logs, this will help me to identify the issue.
If you can update your addon to 0.11.2 and send me back the logs.

If the update not showing up, you can force update check by going to Supervisor -> Addon Store -> 3 dots on top right -> Reload

@dflvunoooooo
Copy link

dflvunoooooo commented Nov 17, 2020

I face the same error. Just noticed it today. I updated to 0.11.2 and here is the log:

Debugger listening on ws://0.0.0.0:9226/426b3082-1923-4bec-8dd9-3affb3ca0703
For help, see: https://nodejs.org/en/docs/inspector
[2020-11-17 19:38:38] [info]: Satus : Go !
[2020-11-17 19:38:38] [info]: Initilizing and checking webdav client...
[2020-11-17 19:38:38] [info]: Starting auto clean cron...
[2020-11-17 19:38:38] [info]: Starting Cron...
[2020-11-17 19:38:38] [info]: Hassio API : Go !
[2020-11-17 19:38:38] [debug]: Nextcloud connection:  Success !
[2020-11-17 19:38:39] [debug]: Path /Hassio Backup/ already exist.
[2020-11-17 19:38:40] [info]: Nextcloud connection : Go !
[2020-11-17 19:38:45] [info]: Downloading snapshot a7ff1c03...
[2020-11-17 19:38:45] [debug]: Snapshot size: 104.79
[2020-11-17 19:38:46] [info]: Download success !
[2020-11-17 19:38:46] [debug]: Snapshot dl size : 104.794921875
[2020-11-17 19:38:46] [info]: Uploading snap...
[2020-11-17 19:38:46] [debug]: ...URI: https://myserveradress/remote.php/webdav/Hassio%20Backup/Manual/Manual-2020-11-17_19-29.tar rejectUnauthorized: true
[2020-11-17 19:38:46] [error]: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:244) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:244) 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: 4)
(node:244) [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 Nov 17, 2020

@dflvunoooooo @poudenes Can you confirm that you have special character in your nextcloud password ?
Like % ?
I was able to reproduce this issue with password %test%test%

@dflvunoooooo
Copy link

Yes, I can confirm that. There are %, ^ and ? in mine.

@Sebclem
Copy link
Owner

Sebclem commented Nov 17, 2020

Ok, can you try the new version ?
I have url encoded password in the request, this should fix your issue.

@poudenes
Copy link
Author

Yes, I can confirm that. There are %, ^ and ? in mine.

Yes I have. But at moment of connecting first time it creates the 2 folders... That means it's not care about that.

But I will try tomorrow when when I'm home with a password without strange characters... I'll let you know!

@dflvunoooooo
Copy link

dflvunoooooo commented Nov 17, 2020

I fear it didn't fix it, but something changed. Here is the log:

Debugger listening on ws://0.0.0.0:9226/d8a9c07f-188d-47bf-bd8a-363740261c41
For help, see: https://nodejs.org/en/docs/inspector
[2020-11-17 22:32:18] [info]: Satus : Go !
[2020-11-17 22:32:18] [info]: Initilizing and checking webdav client...
[2020-11-17 22:32:18] [info]: Starting auto clean cron...
[2020-11-17 22:32:18] [info]: Starting Cron...
[2020-11-17 22:32:18] [info]: Hassio API : Go !
[2020-11-17 22:32:18] [debug]: Nextcloud connection:  Success !
[2020-11-17 22:32:19] [debug]: Path /Hassio Backup/ already exist.
[2020-11-17 22:32:21] [info]: Nextcloud connection : Go !
[2020-11-17 22:32:31] [info]: Downloading snapshot a7ff1c03...
[2020-11-17 22:32:31] [debug]: Snapshot size: 104.79
[2020-11-17 22:32:32] [info]: Download success !
[2020-11-17 22:32:32] [debug]: Snapshot dl size : 104.794921875
[2020-11-17 22:32:32] [info]: Uploading snap...
[2020-11-17 22:32:32] [debug]: ...URI: https://myserveradress/remote.php/webdav/Hassio%20Backup/Manual/Manual-2020-11-17_19-29.tar rejectUnauthorized: true
[2020-11-17 22:32:32] [error]: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
[2020-11-17 22:32:32] [error]: RequestError: URI malformed
    at Request._destroy (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:1224:21)
    at Request.destroy (internal/streams/destroy.js:38:8)
    at /opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:291:26
    at decodeURI (<anonymous>)
    at /opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:271:17
(node:244) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (RequestError: URI malformed) !
(node:244) 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: 4)
(node:244) [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.

@dflvunoooooo
Copy link

dflvunoooooo commented Nov 17, 2020

Yes, I can confirm that. There are %, ^ and ? in mine.

I forgot, there are also ! in my password. Does that matter?

@Sebclem
Copy link
Owner

Sebclem commented Nov 17, 2020

Ok nevermind, it's my fault, i made some mistakes with my commits...

I have also change encoding method that will now encode ? and all other char.
This will be (i hope) fixed with this new release ( 🤞) => 0.11.5

@dflvunoooooo
Copy link

dflvunoooooo commented Nov 17, 2020

I am sorry mate, no success yet. It started uploading but only reached 2%. Here is the log:

Debugger listening on ws://0.0.0.0:9226/3906bc81-36d8-44a7-8f8b-b89f75b2bf01
For help, see: https://nodejs.org/en/docs/inspector
[2020-11-17 22:54:45] [info]: Satus : Go !
[2020-11-17 22:54:45] [info]: Initilizing and checking webdav client...
[2020-11-17 22:54:45] [info]: Starting auto clean cron...
[2020-11-17 22:54:45] [info]: Starting Cron...
[2020-11-17 22:54:45] [info]: Hassio API : Go !
[2020-11-17 22:54:46] [debug]: Nextcloud connection:  Success !
[2020-11-17 22:54:47] [debug]: Path /Hassio Backup/ already exist.
[2020-11-17 22:54:48] [info]: Nextcloud connection : Go !
[2020-11-17 22:54:54] [info]: Initilizing and checking webdav client...
[2020-11-17 22:54:55] [debug]: Nextcloud connection:  Success !
[2020-11-17 22:54:56] [debug]: Path /Hassio Backup/ already exist.
[2020-11-17 22:55:09] [info]: Downloading snapshot a7ff1c03...
[2020-11-17 22:55:09] [debug]: Snapshot size: 104.79
[2020-11-17 22:55:10] [info]: Download success !
[2020-11-17 22:55:10] [debug]: Snapshot dl size : 104.794921875
[2020-11-17 22:55:10] [info]: Uploading snap...
[2020-11-17 22:55:10] [debug]: ...URI: https://myserveradress/remote.php/webdav/Hassio%20Backup/Manual/Manual-2020-11-17_19-29.tar rejectUnauthorized: true
[2020-11-17 22:55:11] [error]: Fail to upload snapshot to nextcloud (HTTPError: Response code 401 (Unauthorized)) !
[2020-11-17 22:55:11] [error]: HTTPError: Response code 401 (Unauthorized)
    at Request._onResponseBase (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:828:31)
    at Request._onResponse (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:866:24)
    at ClientRequest.<anonymous> (/opt/nextcloud_backup/node_modules/got/dist/source/core/index.js:879:23)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:327:22)
    at ClientRequest.origin.emit (/opt/nextcloud_backup/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:315:20)
(node:244) UnhandledPromiseRejectionWarning: Fail to upload snapshot to nextcloud (HTTPError: Response code 401 (Unauthorized)) !
(node:244) 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: 7)
(node:244) [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.

It is at least no malformed error anymore.

@Sebclem
Copy link
Owner

Sebclem commented Nov 17, 2020

arffff, i will take some more test and come back to you as soon i have found a fix.
Thank for your fast reply !

@dflvunoooooo
Copy link

No problem, I am not in a hurry. In fact I am already lying in bed.
I have to thank you, as well for your fast replys and your work!

@Sebclem
Copy link
Owner

Sebclem commented Nov 17, 2020

I think i'm getting closer, i was able to reproduce the 401 error with this password %?!^tetiugeiughe.

So, after some search, it seems that it's a know issue of Got/Node : sindresorhus/got#1317
In comment i found a sort of workaround that consist of manually building the Authorization header instead of using user password options.

I was able to upload snapshot with the password i have mentioned earlier.
Let me know if it's work with your password.
New version is V0.11.6.

Now i need to sleep 😴 ! Good night !

@dflvunoooooo
Copy link

Yeees! It does work for me. Thank you so much! I am sorry that my password caused so much trouble!
I hope it is solved for you as well @poudenes.

@poudenes
Copy link
Author

Hi all, I'm awake now... And see that it's solved already... No input from me... Sorry was asleep. Great job how fast it's solved!!!

@Sebclem Sebclem closed this as completed Nov 18, 2020
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

3 participants