microsoft / microsoft/winget-cli-restsource

Unable to Invoke API Requests

Open
#192 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug
Dominant language
C#
Stars
317
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Brief description of your issue

When calling the API, it returns the below error.
This is not only occouring with /api/information but also with the other functions.
Installing older versions of the Rest-Source fixes the Problem.

Steps to reproduce
  1. Run latest version of the Rest-Source (1.1.20221129)
  2. Call /api/information
Expected behavior

Calling /api/information

image

2022-12-12T09:23:35.445 [Information] Executing 'InformationGet' (Reason='This function was programmatically called via the host APIs.', Id=3c326d7d-f179-47aa-ab9a-adf0fc781a02)
2022-12-12T09:23:35.446 [Information] Executed 'InformationGet' (Succeeded, Id=3c326d7d-f179-47aa-ab9a-adf0fc781a02, Duration=7ms)

Actual behavior

Error after calling /api/information

image

Stacktrace of Server

2022-12-12T09:03:12.730 [Information] Executing 'InformationGet' (Reason='This function was programmatically called via the host APIs.', Id=48169d65-88c7-4778-a241-03fa34ceaab4)
2022-12-12T09:03:13.117 [Error] System.ArgumentNullException: Value cannot be null. (Parameter 'value')at System.Boolean.Parse(String value)at Microsoft.WinGet.RestSource.Functions.Common.CertificateValidationHelper.ValidateAuthentication(HttpRequest req, ILogger log) in D:\a\1\s\src\WinGet.RestSource.Functions\Common\CertificateValidationHelper.cs:line 31at Microsoft.WinGet.RestSource.Functions.ServerFunctions.InformationGetAsync(HttpRequest req, ILogger log) in D:\a\1\s\src\WinGet.RestSource.Functions\ServerFunctions.cs:line 62
2022-12-12T09:03:13.172 [Error] Emitting metric ServerInformationError for function InformationGet on route /api/information'
2022-12-12T09:03:13.246 [Error] Emitting metric 'ServerInformationError'
2022-12-12T09:03:13.290 [Error] Fatal error MonitorTenant is empty
2022-12-12T09:03:13.335 [Error] Fatal error MonitorRole is empty
2022-12-12T09:03:13.378 [Error] {"FunctionName":"InformationGet","Route":"/api/information","Headers":"null","Object":"null","Error":"{"ClassName":"System.ArgumentNullException","Message":"Value cannot be null.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.Boolean.Parse(String value)\r\n at Microsoft.WinGet.RestSource.Functions.Common.CertificateValidationHelper.ValidateAuthentication(HttpRequest req, ILogger log) in D:\\a\\1\\s\\src\\WinGet.RestSource.Functions\\Common\\CertificateValidationHelper.cs:line 31\r\n at Microsoft.WinGet.RestSource.Functions.ServerFunctions.InformationGetAsync(HttpRequest req, ILogger log) in D:\\a\\1\\s\\src\\WinGet.RestSource.Functions\\ServerFunctions.cs:line 62","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"System.Private.CoreLib","WatsonBuckets":null,"ParamName":"value"}"}
2022-12-12T09:03:13.401 [Information] Executed 'InformationGet' (Succeeded, Id=48169d65-88c7-4778-a241-03fa34ceaab4, Duration=670ms)

Environment
- Rest-Source is currently running on the newest release version 1.1.20221129.
- Rest-Source is hosted in a Azure Environment
- Calling /api/information works with previous versions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure against Rest-Source 1.1.20221129 in the Azure environment, then read CertificateValidationHelper.cs at line 31 and ServerFunctions.cs at line 62. Compare the latest release with a version where /api/information works. Done means /api/information and the other API functions no longer fail with the reported null-value exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.