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

LargeFileUploadTask not using GraphError #1557

Open
4 of 5 tasks
alexandru-neacsu07 opened this issue Dec 14, 2023 · 1 comment
Open
4 of 5 tasks

LargeFileUploadTask not using GraphError #1557

alexandru-neacsu07 opened this issue Dec 14, 2023 · 1 comment

Comments

@alexandru-neacsu07
Copy link

alexandru-neacsu07 commented Dec 14, 2023

Bug Report

Prerequisites

  • Can you reproduce the problem?
  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you perform a cursory search?

Description

Errors thrown during a LargeFileUploadTask are not wrapped with GraphError.
Please correct me if I'm wrong, but I was expecting all errors from the API to be wrapped in that class.

In our case, this happened when running multiple uploads, but I think the specific error is irrelevant.

Screenshots:
image

You can see in the screenshot that the "error object" is just the direct response from the API:
https://learn.microsoft.com/en-us/graph/errors#json-representation

Steps to Reproduce

Not sure what to add here, I think this applies to any error during an upload task. We're experiencing this when trying to send multiple emails at once, all with attachments. This causes the MailboxConcurrency error to be thrown.

Expected behavior:
Error to be an instance of GraphError.

Actual behavior:
Error is actually the response object returned by the API.

Additional Context

I've tried to track this down, but it's my first time actually browsing the SDK code.

  1. Upload task tries to handle response:
    const responseBody = await GraphResponseHandler.getResponse(rawResponse);
  2. I'm assuming it's then calling GraphResponseHandler.convertResponse:
    private static async convertResponse(rawResponse: Response, responseType?: ResponseType): Promise<any> {
  3. Again, I'm assuming it goes on the else branch and directly throws the response from the API:
    } else {
    // NOT OK Response
    throw response;
    }

Usage Information

Request ID - Value of the requestId field if you are receiving a Graph API error response

SDK Version - 3.0.6

  • Node (Check, if using Node version of SDK)

Node Version - 18.15.0

@sebastienlevert
Copy link
Contributor

Thanks @alexandru-neacsu07 for reporting! @koros to look and provide feedback on this issue. While this happens @alexandru-neacsu07, would you be willing to submit a PR to fix this issue? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants