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

Error fetching a token with bun #77

Closed
juan-hf opened this issue Dec 22, 2023 · 7 comments
Closed

Error fetching a token with bun #77

juan-hf opened this issue Dec 22, 2023 · 7 comments

Comments

@juan-hf
Copy link

juan-hf commented Dec 22, 2023

This code

import chromeWebstoreUpload from 'chrome-webstore-upload';
import chalk from 'chalk';
import fs from 'fs'; 

const log = console.log; 

const store = chromeWebstoreUpload({
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    refreshToken: 'YOUR_REFRESH_TOKEN',
    extensionId: 'YOUR_EXTENSION_ID'
});

store.fetchToken()
    .then(token => {
        log(chalk.green("Token fetched"), token);
    })
    .catch(error => {
        log(chalk.red('An error occurred:', error));
    });

(I'm of course the values with the right ones)

Throws an error :
error: A retry listener has been attached already.
      at /Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/got/dist/source/core/index.js:94:23
      at makeRequest (/Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/got/dist/source/as-promise/index.js:107:13)
      at /Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/got/dist/source/as-promise/index.js:125:9
      at /Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/p-cancelable/index.js:68:4
      at new Promise (:1:21)
      at new PCancelable (/Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/p-cancelable/index.js:34:19)
      at asPromise (/Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/got/dist/source/as-promise/index.js:21:21)
      at lastHandler (/Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/got/dist/source/create.js:42:27)
      at iterateHandlers (/Users/macmini/Documents/Scripts/Teladoc/MedecinDirect/deploy-chrome-extension/node_modules/got/dist/source/create.js:49:19)
@fregante
Copy link
Owner

Thank you for the report! I think you're using an old version, this no longer uses got. Also potentially you're on an old Node version.

Closing for now.

Also you probably want to use the cli version directly if your script is only that: https://github.com/fregante/chrome-webstore-upload-cli

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
@juan-hf
Copy link
Author

juan-hf commented Dec 22, 2023

Hello,
my package.json shows
"chrome-webstore-upload": "^2.0.0" which seems to be the latest version
Also, I'm not using node.js but bun.js

I'll try using the cli but I wanted to provide full context

@fregante
Copy link
Owner

Oh I didn't realize that I haven't released it yet: https://github.com/fregante/chrome-webstore-upload/commits/main/

Also, I'm not using node.js but bun.js

That's an important piece of information that you should include when opening bug reports.

You can follow:

I'll try using the cli but I wanted to provide full context

Thank you ☺️

@fregante
Copy link
Owner

I just released v3, which drops got and it fixes this specific issue. It'd be great if you could try it and report back if it works or if it has more issue.

@juan-hf
Copy link
Author

juan-hf commented Dec 22, 2023

Just tested, it works with bun

Thanks for your reactivity

@fregante
Copy link
Owner

Happy to hear it fixed it! If you have issues with the cli version I'll update that one too, it still uses got

@fregante
Copy link
Owner

Actually you can already try the preview version with fetch: npx chrome-webstore-upload@next

@fregante fregante changed the title Error fetching a token Error fetching a token with bun Dec 27, 2023
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

2 participants