Onedrive-api-docs: OneDrive item ID is undefined when selecting a SharePoint file

Created on 25 Feb 2019  路  15Comments  路  Source: OneDrive/onedrive-api-docs

Category

  • [ ] Question
  • [ ] Documentation issue
  • [x] Bug

Expected or Desired Behavior

Using the OneDrive JS file picker v7.2, selecting a SharePoint file from the Recent tab should properly generate the API request URL.

Observed Behavior

After successfully opening the picker, navigating to Recent, and selecting a SharePoint file from the UI, the request made by the SDK is missing the driveitem ID in the URL.

GET https://graph.microsoft.com/v1.0/drives/<user_drive_id>/items/undefined/?expand=etc...

ms-onedrive-file-select-error

This, understandably, results in a 404 Not Found response:

{
  "error": {
    "code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
    "message": "Cannot find resource for the request undefined.",
    "innerError": {
      "request-id": "59d430ec-47d8-49fb-8271-6620e0b9611c",
      "date": "2019-02-25T22:24:52"
    }
  }
}

Note that selecting this exact same file when navigating the SharePoint Document hierarchy works just fine. It's only when selecting this file from the "Recent" tab that the error occurs.

Steps to Reproduce

This is the configuration we are using to open the file picker:

let options = {
  clientId: <client_id>,
  action: 'query',
  multiSelect: false,
  advanced: {
    redirectUri: <redirectUri>,
    queryParameters: 'select=id,name,size,file,package,@microsoft.graph.downloadUrl&expand=thumbnails',
  },
  success: () => {},
  error: () => {},
  cancel: () => {},
};

OneDrive.open(options);

From what I understand, our specified scopes are simply the defaults: User.Read, Files.Read.All.

Please let me know if I've left anything out that might be helpful!

Thank you.

Picker resolved bug

Most helpful comment

Tentative ETA for fix rolled-out to 100% of PROD is 4/8 EOD

All 15 comments

Thank you for your contribution to OneDrive API Docs. We will be triaging your incoming issue as soon as possible.

Thanks for reporting this @elidupuis. This looks like it may be related to an API change with "Recent items". I'm following-up with the internal group cc: @ificator. Hope to provide a fix ETA soon.

@elidupuis I debugged this a bit further. The advanced.queryParameters cause the Picker to make an additional request to fetch the fields specified. In preparing the request, it looks like we are incorrectly parsing the ID to fetch hence the 404.

Given the above, the problem may reside on the JS side. I need to dig further.

I'm curious, two questions while I continue to debug:

1) Was this working and recently regressed?
2) Is it possible to temporarily workaround this issue by omitting the queryParameters from the config and making the REST call with the correct ID once the Picker success callback is invoked?

Your scopes look correct btw.

@KevinTCoughlin Thanks!

  1. Was this working and recently regressed?

I discovered this issue implementing the OneDrive file picker, so I can't say if it's regressed.

2. Is it possible to temporarily workaround this issue by omitting the queryParameters from the config and making the REST call with the correct ID once the Picker success callback is invoked?

I'll give this a try and let you know how it goes.

@KevinTCoughlin I tried omitting the queryParameters from the initial OneDrive.open() call and the response looks like this:

{
    "webUrl": null,
    "value": [{
        "parentReference": {
            "driveId": <redacted>
        },
        "sharePoint": {
            "uniqueId": <redacted>
        }
    }],
    "accessToken": <redacted>,
    "apiEndpoint": "https://graph.microsoft.com/v1.0/"
}

The parentReference.driveId matches the driveId and I assume the sharePoint.uniqueId is the driveItem ID that was undefined initially. I used these values and attempted to recreate the REST call but I keep getting 404'd:

{
  "error": {
    "code": "itemNotFound",
    "message": "The resource could not be found.",
    "innerError": {
      "request-id": "0e04b89d-4f48-4033-a326-bec36141b7cb",
      "date": "2019-03-02T00:13:51"
    }
  }
}

Am I correct in assuming that sharePoint.uniqueId represents the missing drive item ID?

@elidupuis @ldcm3 it looks like this is a bug with how the hosted page maps the Graph ID for the selected entity / entities in "Recent" tab under -my tenant.. We're working on a patch to the hosted page that will need to roll-out to address.

The item id is currently being omitted from the response under the -my tenant. Without that information neither the SDK nor additional Graph API calls will resolve.

Will follow-up with additional information re: roll-out status as I have it.

cc: @aditima @ThomasMichon

Tentative ETA for fix rolled-out to 100% of PROD is 4/8 EOD

Thanks for the update @KevinTCoughlin

Hey @KevinTCoughlin , do you think we are gonna be able to keep this ETA? It seems not working for me at this time. Thanks

Hey @KevinTCoughlin , do you think we are gonna be able to keep this ETA? It seems not working for me at this time. Thanks

It looks like the build containing the fix didn't make it out due to unrelated circumstances. We're working to cherry-pick the change.

Oh thats unfortunate. =/
Could you please share a new ETA when you have one?

Oh thats unfortunate. =/
Could you please share a new ETA when you have one?

@ldcm3, I've confirmed that the build currently rolling-out contains the fix. It is serving 50% of traffic at the time of me authoring this comment. Unfortunately, the prior build did not contain the fix.

Will update the thread when fully rolled-out.

Since we have confirmations that this fix is available in prod, I'm going to let the bot close this out over the next few days.

Thanks to @elidupuis and @ldcm3 for reporting and coordination. Special thanks to @ThomasMichon for the fix.

Awesome. Thanks everyone! 鉂わ笍

Closing as fixed!

Was this page helpful?
0 / 5 - 0 ratings