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

ListZones not work due to deserialize json fail! #198

Open
derust opened this issue Jan 7, 2023 · 3 comments · May be fixed by #199
Open

ListZones not work due to deserialize json fail! #198

derust opened this issue Jan 7, 2023 · 3 comments · May be fixed by #199

Comments

@derust
Copy link

derust commented Jan 7, 2023

        let req = ListZones { params };
        let resp: Vec<Zone> = self.api_client.request_handle(&req).await?.result;
      //this fail with: error decoding response body: invalid type: null, expected a string at line 1 column 615)

parse fail happens at this line
ListZones

        let parsed: Result<ApiSuccess<ResultType>, reqwest::Error> = resp.json();

the response json which fail to be parsed

{
    "result": [
        {
            "id": "xxxxxxxxxxxxxxxxxxx",
            "name": "xxxx.com",
            "status": "active",
            "paused": false,
            "type": "full",
            "development_mode": 0,
            "name_servers": [
                "frank.ns.cloudflare.com",
                "sandy.ns.cloudflare.com"
            ],
            "original_name_servers": null,
            "original_registrar": "name.com, inc. (id: 625)",
            "original_dnshost": null,
            "modified_on": "2021-11-12T21:01:17.744476Z",
            "created_on": "2020-11-18T10:40:49.839936Z",
            "activated_on": "2020-11-18T10:43:07.087867Z",
            "meta": {
                "step": 2,
                "custom_certificate_quota": 0,
                "page_rule_quota": 3,
                "phishing_detected": false,
                "multiple_railguns_allowed": false
            },
            "owner": {
                "id": null,
                "type": "user",
                "email": null
            },
            "account": {
                "id": "xxxxxxxxxxxxxxxxxxxx",
                "name": "xxxxxxxxxxxxx"
            },
            "tenant": {
                "id": null,
                "name": null
            },
            "tenant_unit": {
                "id": null
            },
            "permissions": [
                "#access:edit",
                "#access:read",
                "#analytics:read",
                "#app:edit",
                "#auditlogs:read",
                "#billing:edit",
                "#billing:read",
                "#blocks:edit",
                "#blocks:read",
                "#cache_purge:edit",
                "#dash_sso:edit",
                "#dash_sso:read",
                "#dns_records:edit",
                "#dns_records:read",
                "#fbm_acc:edit",
                "#fbm:edit",
                "#fbm:read",
                "#healthchecks:edit",
                "#healthchecks:read",
                "#http_applications:edit",
                "#http_applications:read",
                "#image:edit",
                "#image:read",
                "#lb:edit",
                "#lb:read",
                "#legal:edit",
                "#legal:read",
                "#logs:edit",
                "#logs:read",
                "#magic:edit",
                "#magic:read",
                "#member:edit",
                "#member:read",
                "#organization:edit",
                "#organization:read",
                "#ssl:edit",
                "#ssl:read",
                "#stream:edit",
                "#stream:read",
                "#subscription:edit",
                "#subscription:read",
                "#teams:edit",
                "#teams:pii",
                "#teams:read",
                "#teams:report",
                "#waf:edit",
                "#waf:read",
                "#waitingroom:edit",
                "#waitingroom:read",
                "#webhooks:edit",
                "#webhooks:read",
                "#worker:edit",
                "#worker:read",
                "#zaraz:edit",
                "#zaraz:publish",
                "#zaraz:read",
                "#zone:edit",
                "#zone:read",
                "#zone_settings:edit",
                "#zone_settings:read",
                "#zone_versioning:edit",
                "#zone_versioning:read"
            ],
            "plan": {
                "id": "0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
                "name": "Free Website",
                "price": 0,
                "currency": "USD",
                "frequency": "",
                "is_subscribed": false,
                "can_subscribe": false,
                "legacy_id": "free",
                "legacy_discount": false,
                "externally_managed": false
            }
        }
    ],
    "result_info": {
        "page": 1,
        "per_page": 20,
        "total_pages": 1,
        "count": 1,
        "total_count": 1
    },
    "success": true,
    "errors": [],
    "messages": []
}
@Mange
Copy link

Mange commented Jun 14, 2023

I'm also having this problem.

Maintainers: Is there anything I can do to help get a fix out?

Mange added a commit to Mange/cloudflare-dyndns-rs that referenced this issue Jun 14, 2023
Sadly it has a bug that prevents the "List Zones" API from working.
(See cloudflare/cloudflare-rs#198)

One workaround for this is to not use "List Zones" and instead accepting
a Zone ID directly. The CLI arguments now require a Zone ID or a Zone
Name to be specified, and Zone Name will only be used if no Zone ID is
present.

We also switch over to Token-based auth for this version.
@nrdxp
Copy link

nrdxp commented Sep 1, 2023

I am blocked by this as well now. Had a code base making API requests using reqwest manually and I refactored to use this crate instead. Now I cannot test as I got stuck here.

@taladar
Copy link

taladar commented Aug 30, 2024

Judging by the value

     "owner": {
                "id": null,
                "type": "user",
                "email": null
            },

and the fact that I ran into the same issue just now this is likely a duplicate of #193

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

Successfully merging a pull request may close this issue.

4 participants