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

Bug with the paging of Addresses and Domains #16

Open
Gaz83 opened this issue Jul 25, 2023 · 0 comments
Open

Bug with the paging of Addresses and Domains #16

Gaz83 opened this issue Jul 25, 2023 · 0 comments

Comments

@Gaz83
Copy link

Gaz83 commented Jul 25, 2023

There seems to be an issue with the paging for the reserved addresses and domains. I seem to be getting the following NgrokException

ErrorCode: "ERR_NGROK_223"
Message: 'ra_4zAZAYTuXs2aLUC6FZV8H' is not a valid resource reference identifier.
StatusCode: 400

StackTrace:
at NgrokApi.ApiHttpClient.d__13.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\Logwood.NgrokApi\ApiHttpClient.cs:line 89
at NgrokApi.ApiHttpClient.d__101.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\Logwood.NgrokApi\ApiHttpClient.cs:line 52 at NgrokApi.ReservedAddrs.<ListPage>d__11.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\Logwood.NgrokApi\Services\ReservedAddrs.cs:line 107 at NgrokApi.ReservedAddrs.<>c__DisplayClass12_0.<<List>b__0>d.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\Logwood.NgrokApi\Services\ReservedAddrs.cs:line 145 at NgrokApi.Iterator1.d__3.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\Logwood.NgrokApi\Iterator.cs:line 34
at NgrokApi.Iterator`1.d__3.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at Logwood.Cache.Application.NgrokService.d__4.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\src\Application\Logwood.Cache.Application\NgrokService.cs:line 91
at Logwood.Cache.Application.NgrokService.d__4.MoveNext() in D:\Git Repositories\Current\Services\Cache Service\src\Application\Logwood.Cache.Application\NgrokService.cs:line 91

I managed to solve the issue for both addresses and domains by doing the following modification in 'ReservedAddrs' class and 'ReservedDomains' class. Was just something quick for testing.

Add the following parameters to the class.

` public string NextPageUri { get; set; }

    private bool HasNextPage = true;`

Then modify ListPage method like so.

` private async Task ListPage(Paging arg)
{
if (HasNextPage)
{
//Dictionary<string, string> query = null;
Paging body = null;
//query = new Dictionary<string, string>()
//{
// ["before_id"] = arg.BeforeId,
// ["limit"] = arg.Limit,
//};
var result = await apiClient.Do(
path: $"/reserved_domains",
method: new HttpMethod("get"),
body: body,
query: query
);

            if (!string.IsNullOrWhiteSpace(result.NextPageUri))
            {
                HasNextPage = true;

                var uriQuery = result.NextPageUri.Replace(result.Uri + "?", "");
                var uriQuerySplit = uriQuery.Split("&");

                foreach (var parameter in uriQuerySplit)
                {
                    var parameterSplit = parameter.Split("=");

                    query[parameterSplit[0]] = parameterSplit[1];
                }
            }
            else
                HasNextPage = false;

            return result;
        }

        return new ReservedDomainList() { ReservedDomains = new List<ReservedDomain>() };
    }`
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

1 participant