Skip to content

not working with deno v2.3.3 #425

Open
@stelf

Description

@stelf

Hi, team

I just tried to migrate my project to Deno and figured the discogs-client lib doesn't work.

The minimal example that I try with is:

import { DiscogsClient } from '@lionralfs/discogs-client';

const client = new DiscogsClient({
    userAgent: 'TelegramProtectorBot/1.0',
    auth: { userToken: "GASlqTPeZBdVHsSILNVaPpgkAjPadoLBZluCfMAi" },
});

client.database().getRelease(10953035).then((res) => {
    console.log(res.data);
})

this I try as minitest.mjs both in Node and Deno, and the deno version gets undefined data, but a defined rate limits.

this boils down to how Deno exposes the fetch2 response object, which seems to be struggling with gzip decompression when .json() is called in

private rawRequest(options: RequestOptions, callback: RequestCallback, failedAttempts = 0) {

I tried to patch it but unsuccessfully, it seems my Deno writing skills not good yet .) no matter what I did, all the methods failed with premature stream closure, which is weird to me.

the fact it silently dies is due to this. code

                let data: unknown;
                if (options.json) {
                    data = await res.json().catch(
                        // eslint-disable-next-line @typescript-eslint/no-empty-function
                        () => {}
                    );
                } else {
                    data = res;
                }

where the .json() call is handled with silent catch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions