azure functions "An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set."

JAPNAM SINGH 81 Reputation points
2021-07-26T14:02:48.223+00:00

Hi,

I am getting the error when I publish the azure function, locally it does not complain the URI The error message is "An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set."

var driveitempath =graphendpoint + "/sites/" + Environment.GetEnvironmentVariable("pdf:SiteId") + "/drive/items";

string url = drivesitempath + "/" + fileId + "/content?format=pdf"
httpClient.GetAsync(url);

So, if I hard-code the url it works ,but I am trying to achieve no hard-coded values.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,932 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 70,941 Reputation points Moderator
    2021-07-27T06:36:02.74+00:00

    @JAPNAM SINGH I will suggest to debug or log the value for individual parameter that you are using to build the URI and see if any of the parameter (i.e. graphendpoint etc.) is coming null or empty while retrieving the value. As per the error the parameter url is not correctly formed and while executing httpClient.GetAsync(url) it throws exception.
    If you are getting the value from configuration of your function app. Please make sure that you have define the application setting and value on your function app.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.