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

Wrong baseUrl after upgrading to 2.0.0-RC15 #1263

Closed
hubipe opened this issue Jun 16, 2023 · 1 comment
Closed

Wrong baseUrl after upgrading to 2.0.0-RC15 #1263

hubipe opened this issue Jun 16, 2023 · 1 comment
Assignees
Labels

Comments

@hubipe
Copy link

hubipe commented Jun 16, 2023

Hello,
after upgrading from RC14 to RC15 and updating graph initialization from:

$graphServiceClient  = new GraphServiceClient($this->getGraphRequestAdapter());

to

$graphServiceClient =  GraphServiceClient::createWithRequestAdapter($this->getGraphRequestAdapter());

the requests started to failing on HTTP 404 response code. The problem is with the baseUrl. GraphServiceClient::createWithRequestAdapter sets baseUrl from the second argument $nationalCloud as a (default) value https://graph.microsoft.com. The URL of the requested resource then looks like:

https://graph.microsoft.com/drives/<driveId>/items/<itemId>/preview

image

but should look like

https://graph.microsoft.com/v1.0/drives/<driveId>/items/<itemId>/preview (notice the „/v1.0“)

image

I've handled wrong default baseUrl by passing second argument to the createWithRequestAdapter method like this:

$requestAdapter = $this->getGraphRequestAdapter();
return GraphServiceClient::createWithRequestAdapter($requestAdapter, $requestAdapter->getBaseUrl());

Then the base URL (nationalCloud) is correctly set as https://graph.microsoft.com/v1.0, but I think this method should set the baseUrl correctly by default.

@Ndiritu
Copy link
Contributor

Ndiritu commented Jul 6, 2023

@hubipe thanks for reporting this. It should be resolved from 2.0.0-RC16

@Ndiritu Ndiritu closed this as completed Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants