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

Bug: OneDrive HTTP 400 response when using ONEDRIVE_SINGLE_DIRECTORY with Docker #2318

Closed
NigelVanHattum opened this issue Feb 26, 2023 · 6 comments · Fixed by #2319
Closed
Labels
Bug Something isn't working Fixed

Comments

@NigelVanHattum
Copy link
Contributor

Describe the bug

The OneDrive API return a HTTP 400 on my single sync config

Operating System Details

I'm running in docker. my config looks like:

      - ONEDRIVE_UID=1000
      - ONEDRIVE_GID=1000
      - ONEDRIVE_RESYNC=1
      - ONEDRIVE_DEBUG=1
      - ONEDRIVE_DEBUG_HTTPS=1
      - ONEDRIVE_SINGLE_DIRECTORY=hassBackups

Client Installation Method

From Source

OneDrive Account Type

Personal

What is your OneDrive Application Version

Docker

What is your OneDrive Application Configuration

See above

What is your 'curl' version

Docker image

Where is your 'sync_dir' located

Local

What are all your system 'mount points'

None

What are all your local file system partition types

Docker

How do you use 'onedrive'

Via Docker

Steps to reproduce the behaviour

Docker-compose up onedrive-sync

Complete Verbose Log Output

onedrive-sync    | [DEBUG] ################################################## NEW SYNC ##################################################
onedrive-sync    | Syncing changes from this selected path: "hassBackups"
onedrive-sync    | Getting path details from OneDrive ...
onedrive-sync    | [DEBUG] Calling onedrive.getPathDetailsByDriveId(driveId, path) with: a9b3fea954c197e7, "hassBackups"
onedrive-sync    | [DEBUG] Request URL = https://graph.microsoft.com/v1.0/drives/a9b3fea954c197e7/root:/%22hassBackups%22?select=id,name,eTag,cTag,deleted,file,folder,root,fileSystemInfo,remoteItem,parentReference,size
onedrive-sync    | * Found bundle for host graph.microsoft.com: 0x1ab9a010 [serially]
onedrive-sync    | * Can not multiplex, even if we wanted to!
onedrive-sync    | * Re-using existing connection! (#1) with host graph.microsoft.com
onedrive-sync    | * Connected to graph.microsoft.com (40.126.32.161) port 443 (#1)
onedrive-sync    | > GET /v1.0/drives/<onedrive-root-id (without upper case for some reason)>/root:/%22hassBackups%22?select=id,name,eTag,cTag,deleted,file,folder,root,fileSystemInfo,remoteItem,parentReference,size HTTP/1.1
onedrive-sync    | Host: graph.microsoft.com
onedrive-sync    | User-Agent: ISV|abraunegg|OneDrive Client for Linux/v2.4.23-4-g5698f9d
onedrive-sync    | Accept: */*
onedrive-sync    | Authorization: bearer <redacted>
onedrive-sync    |
onedrive-sync    | * Mark bundle as not supporting multiuse
onedrive-sync    | < HTTP/1.1 400 Bad Request
onedrive-sync    | < Transfer-Encoding: chunked
onedrive-sync    | < Content-Type: application/json
onedrive-sync    | < Strict-Transport-Security: max-age=31536000
onedrive-sync    | < request-id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
onedrive-sync    | < client-request-id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
onedrive-sync    | < x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"xxxxxxxxxxxxxxx"}}
onedrive-sync    | [DEBUG] onedrive.perform() => OneDrive HTTP Server Response: 400
onedrive-sync    | [DEBUG] http.perform() => HTTP Response Headers: ["strict-transport-security":"max-age=31536000", "x-ms-ags-diagnostic":"{\"ServerInfo\":{\"DataCenter\":\"West Europe\",\"Slice\":\"E\",\"Ring\":\"5\",* Connection #1 to host graph.microsoft.com left intact
onedrive-sync    | \"ScaleUnit\":\"002\",\"RoleInstance\":\"xxxxxxxxxxxxxxx\"}}", "transfer-encoding":"chunked", "date":"Sun, 26 Feb 2023 10:28:08 GMT", "client-request-id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "request-id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "content-type":"application/json"]
onedrive-sync    | [DEBUG] onedrivePathDetails = onedrive.getPathDetails(path) generated a OneDriveException
onedrive-sync    | Can we log the response: null
onedrive-sync    | [DEBUG] onedrive.getPathDetails call returned an invalid JSON Object
onedrive-sync    | Giving up on sync after three attempts: "hassBackups": No such file or directory
onedrive-sync    | [DEBUG] Failure scope called
onedrive-sync    | [DEBUG] Running cleanupDryRunDatabase
onedrive-sync    | [DEBUG] Removing items-dryrun.sqlite3 as dry run operations complete
onedrive-sync    | std.file.FileException@/usr/lib/ldc/aarch64-redhat-linux-gnu/include/d/std/file.d(2055): "hassBackups": No such file or directory
onedrive-sync    | ----------------[DEBUG] Exit scope called
onedrive-sync    |
onedrive-sync    | /usr/lib/ldc/aarch64-redhat-linux-gnu/include/d/std/file.d:283 @safe uint std.file.getAttributes!(immutable(char)[]).getAttributes(immutable(char)[]) [0x542e6f]
onedrive-sync    | /usr/lib/ldc/aarch64-redhat-linux-gnu/include/d/std/file.d:2354 [0x4b8313]
onedrive-sync    | src/main.d:1837 [0x4f7c4f]
onedrive-sync    | src/main.d:1646 [0x4ebf43]

Screenshots

No response

Other Log Information or Details

No response

Additional context

I think I've found the solution, I will create a PR for it.

@NigelVanHattum NigelVanHattum added the Bug Something isn't working label Feb 26, 2023
@NigelVanHattum
Copy link
Contributor Author

The problem seems to be that if you put in the docker environment variable to perform a single-dir sync, it puts quotes surrounding it. During my debugging I've also found another bug in the new docker single-dir setup.

I will fix both.

@abraunegg
Copy link
Owner

@NigelVanHattum
Thanks for looking at this and fixing the bug

@abraunegg abraunegg changed the title Bug: OneDrive HTTP 400 response Bug: OneDrive HTTP 400 response when using ONEDRIVE_SINGLE_DIRECTORY with Docker Feb 28, 2023
@abraunegg
Copy link
Owner

@NigelVanHattum
Any update in testing the updated PR?

@NigelVanHattum
Copy link
Contributor Author

@abraunegg
Sorry, I have been quiet busy. I will try to look into this today, otherwise this weekend.

@abraunegg
Copy link
Owner

@NigelVanHattum
Please can you test the updated PR - onedrive v2.4.23-17-ge746bfb

@abraunegg
Copy link
Owner

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Repository owner locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working Fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants