chrome-webstore-upload-cli icon indicating copy to clipboard operation
chrome-webstore-upload-cli copied to clipboard

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Open dmzoneill opened this issue 1 year ago • 2 comments

sudo npm install -g chrome-webstore-upload-cli

added 37 packages in 5s

21 packages are looking for funding
  run `npm fund` for details
dave@dave-pc:~/src/docker-media-center/config/sodarr-chrome-plugin/chrome-plugin$ npm list -g chrome-webstore-upload
/usr/local/lib
├─┬ [email protected]
│ └── [email protected]
└── [email protected]
$ chrome-webstore-upload upload --source ../chrome-extension.zip --extension-id ........ --client-id ......... --client-secret ........ --refresh-token ...... --auto-publish
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at handlePublishStatus (file:///usr/local/lib/node_modules/chrome-webstore-upload-cli/util.js:8:27)
    at doAutoPublish (file:///usr/local/lib/node_modules/chrome-webstore-upload-cli/cli.js:90:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async init (file:///usr/local/lib/node_modules/chrome-webstore-upload-cli/cli.js:167:9)
    at async file:///usr/local/lib/node_modules/chrome-webstore-upload-cli/cli.js:176:5

dmzoneill avatar Jan 05 '24 10:01 dmzoneill

Are you using Node 18+?

Also you don't need to install chrome-webstore-upload if you use the cli version

fregante avatar Jan 05 '24 11:01 fregante

So I think this is because the publishing is failing, but I don't handle the response correctly. It looks like status isn't set, but something like error will be.

Can you add a console.log(publishResponse) in cli.js in your global node_modules? I'd like to see what the response looks like and what the error is.

fregante avatar Jan 05 '24 18:01 fregante

I'm running into this one as well on GitHub actions. https://github.com/kj800x/nulinks/actions/runs/7505963707/job/20436589755

kj800x avatar Jan 12 '24 18:01 kj800x

Here's the log I'm getting after logging out publishResponse. Hopefully it helps! I'm gonna go dig into the mess that is the GCP website to see if I can fix my issue.

./node_modules/.bin/chrome-webstore-upload upload --source nulinks-extension.zip --extension-id gfbdcgkehhkgfehdilpmldkeihiojjak --auto-publish
⠴ Publishing{
  error: {
    code: 400,
    message: 'Publish condition not met: You must verify your contact email before you can publish any item. Begin the verification process on the Account tab.',
    errors: [ [Object] ]
  }
}
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at handlePublishStatus (file:///Users/kjohnson/testing/node_modules/chrome-webstore-upload-cli/util.js:8:27)
    at doAutoPublish (file:///Users/kjohnson/testing/node_modules/chrome-webstore-upload-cli/cli.js:93:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async init (file:///Users/kjohnson/testing/node_modules/chrome-webstore-upload-cli/cli.js:170:9)
    at async file:///Users/kjohnson/testing/node_modules/chrome-webstore-upload-cli/cli.js:179:5
    ```

kj800x avatar Jan 12 '24 18:01 kj800x

Oh and here's publishResponse.error.errors in case that's helpful too:

[
  {
    message: 'Publish condition not met: You must verify your contact email before you can publish any item. Begin the verification process on the Account tab.',
    domain: 'chromewebstore.access',
    reason: 'badRequest'
  }
]

kj800x avatar Jan 12 '24 18:01 kj800x

Thank you! So yeah the error is due to the store, but the module isn't displaying it properly because it tries to read status before checking for errors.

PR welcome to fix it.

fregante avatar Jan 12 '24 18:01 fregante

As for the API error, you do need to take action in your own Dashboard, it's not something related to the uploader.

fregante avatar Jan 12 '24 19:01 fregante

I see what happened. In the latest version I started using fetch instead of got. Everything works, except that got used to throw on non-200 HTTP responses, while fetch does not.

fregante avatar Jan 13 '24 14:01 fregante

This is fixed in the current version.

https://github.com/fregante/chrome-webstore-upload/releases/tag/v3.0.3

If you installed chrome-webstore-upload-cli locally:

npm rm chrome-webstore-upload-cli chrome-webstore-upload
npm i chrome-webstore-upload-cli

If you installed chrome-webstore-upload-cli globally:

npm rm -g chrome-webstore-upload-cli chrome-webstore-upload
npm i -g chrome-webstore-upload-cli

If you're running it with npx:

npx clear-npx-cache
npx chrome-webstore-upload-cli

fregante avatar Jan 14 '24 09:01 fregante