question

hannah avatar image
hannah asked

HttpRequest does not contain a definition for ReadAsStringAsync

trying to write an azure cloud function for deleting player data, and I can't get the args from the execute function call because the httprequest shown in all the examples I can find doesn't have a definition for ReadAsStringAsync, and that's the only way I have found only to get the args.

  FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await httpRequest.ReadAsStringAsync());
 var args = context.FunctionArgument;
CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

May I know if you are using the .NET 6 runtime when creating your Azure Function project? If so, you may try using namespace “Microsoft.Azure.WebJobs.Extensions.Http” in your code to see if the issue persists. And the ReadAsStringAsync method is a static method in static class “HttpRequestExtensions” under “Microsoft.Azure.WebJobs.Extensions.Http” namespace. In addition, currently, the code provided in PlayFab Azure function docs are suitable for Azure Functions V4 and .NET 6. If you want to use higher version like .NET 8 or using .NET 6 isolated, you could post a feature request for it.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.