nodejs / i18n

The Node.js Internationalization Working Group – A Community Committee initiative.
MIT License
150 stars 39 forks source link

Crowdin Glossary Upload giving a 404 #262

Closed nschonni closed 4 years ago

nschonni commented 4 years ago

It's running now, but silently failing for a different reason :( https://github.com/nodejs/i18n/runs/540255470?check_suite_focus=true

Originally posted by @nschonni in https://github.com/nodejs/i18n/pull/254#issuecomment-605212737

 Problem uploading glossary
GotError [HTTPError]: Response code 404 (Not Found)
    at /home/runner/work/i18n/i18n/node_modules/got/index.js:386:13
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  name: 'HTTPError',
  host: 'api.crowdin.com',
  hostname: 'api.crowdin.com',
  method: 'POST',
  path: '/api/project/nodejs/upload-glossary?key=***',
  protocol: 'https:',
  url: 'https://api.crowdin.com/api/project/nodejs/upload-glossary?key=***',
  statusCode: 404,
  statusMessage: 'Not Found',
  headers: {
    date: 'Fri, 27 Mar 2020 18:34:13 GMT',
    'content-type': 'application/json',
    'transfer-encoding': 'chunked',
    connection: 'close',
    server: 'nginx',
    vary: 'Accept-Encoding',
    'access-control-allow-origin': '*',
    'access-control-allow-methods': 'GET, POST, OPTIONS, DELETE, PATCH, PUT',
    'access-control-allow-headers': 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,ETag,Accept,AcceptEncoding,Authorization,Crowdin-API-FileName,X-Crowdin-Integrations-User-Agent',
    'access-control-allow-credentials': 'true',
    'content-encoding': 'gzip'
  }
}
zeke commented 4 years ago

Hmm. The URL looks right on the surface: https://support.crowdin.com/api/upload-glossary/

zeke commented 4 years ago

cc @crowdin-support any idea what might be wrong here?

Andrulko commented 4 years ago

Hi @nschonni and @zeke! Trying to reproduce on my machine via Postman. You may try uploading the glossary via JS client built on top of our API v2: https://github.com/crowdin/crowdin-api-client-js

Also, can you please let us know what is the extension of glossary file? Is it .tbx, .xlsx or .csv?

nschonni commented 4 years ago

It's JSON in the repo, but is built up and pushed through https://github.com/nodejs/i18n/blob/master/script/upload-crowdin-glossary.js

Andrulko commented 4 years ago

Thanks! JSON is not converted to .tbx, .xlsx or .csv as I understand? Unfortunately, it cannot be accepted. There is "json" parameter described in docs but it's used only for purpose of receiving responses in JSON: https://support.crowdin.com/api/upload-glossary/

Would it be possible to switch to any file type mentioned above? My colleague has managed to upload .tbx but I'd recommend CSV - it's easier to edit :)

zeke commented 4 years ago

Hey @Andrulko 👋 Long time no see.

The underlying crowdin-glossary node module is already converting the JS / JSON input into CSV here: https://github.com/crowdin-node/crowdin-glossary/blob/f9cd09f204fb9b028260ec2c616e631f8ba9fe54/index.js#L40-L45

We've used this module before to successfully upload glossary data, and the implementation hasn't changed in some time. Is it possible that this Crowdin v1 API has changed in some way?

denisqua commented 4 years ago

Hello @zeke

Hope, you're doing well!

I'm not sure whether we changed something on our side, but let me re-check with developers and get back to you

denisqua commented 4 years ago

Hi @zeke and @nschonni!

Coming back with additional news on the matter:

As tech guys informed, we don't change API v1 in any way, changes could be only on API v2, because we're working on it

Concerning your 404 Error:

We've just checked on our database and can see that you used wrong API key, from the last time API Key was changed, that's why you've got 404 messages

Kindly compare your current API key and last API log: https://crowdin.com/project/nodejs/settings#api

What I can recommend also (it's not necessary to do) : You may provide manager access to the NodeJS project for user who works with API and then you he/she will be able to use this request:

https://api.crowdin.com/api/project/{project-identifier}/upload-glossary?login={username}&account-key={account-key}

Instead of that one: https://api.crowdin.com/api/project/{project-identifier}/upload-glossary?key={project-key}

Take care,

zeke commented 4 years ago

Thanks for the guidance @denisqua ✨

I just:

Let's see if that resolves the issue.

alexandrtovmach commented 4 years ago

@zeke does it working now?

zeke commented 4 years ago

I don't think it has run since this change was made. Here's the last run from 8 days ago: https://github.com/nodejs/i18n/actions/runs/65243014

Here's what triggers the workflow: https://github.com/nodejs/i18n/blob/4e18ed81a8d71ba0ee0f2aa5e8c788aec6068cba/.github/workflows/glossary.yml#L3-L12

Anyone should be able to test this by opening (and merging) a PR that adds or updates a glossary entry.

alexandrtovmach commented 4 years ago

Works now https://github.com/nodejs/i18n/actions/runs/71474551 Thanks for investigation!

zeke commented 4 years ago

Nice 🙌