readmeio / rdme

ReadMe's official command-line interface (CLI) and GitHub Action 🌊
https://docs.readme.com/main/docs/rdme
MIT License
105 stars 42 forks source link

Asking for credentials providing valid key parameter and update flag #960

Closed jirp-upc closed 6 months ago

jirp-upc commented 10 months ago

Doing:

rdme openapi (filepath) --key=VALIDAPIKEY --update

or

rdme openapi (filepath) --key=VALIDAPIKEY --id=VALIDID --update

Asks for credentials. I would like to do this operation unattended.

kanadgupta commented 10 months ago

Hi @jirp-upc! We'll need some more info in order to be helpful here:

  1. What version of rdme are you using?
  2. What environment are you running rdme in? (a CI environment, a local CLI, etc.)
  3. I recommend inspecting your debug logs to see if anything looks out of the ordinary. And if you could share the redacted logs, that'd be helpful!

Thanks!

jirp-upc commented 10 months ago

Hi @kanadgupta ,

  1. 8.6.6
  2. Currently, a local CLI.
  3. Here is the debug prompt:
  rdme raw process.argv: ["openapi","wonderfulOAS.json","--key=rdme_FOOKEY","--update"] +0ms
  rdme command-line-args processing: {"_unknown":["wonderfulOAS.json","--key=rdme_FOOKEY","--update"],"command":"openapi"} +1ms
  rdme command: openapi +1ms
  rdme opts: {"key":"rdme_FOOKEY","spec":"wonderfulOAS.json","update":true} +0ms
- Validating the API definition located at wonderfulOAS.json...
  rdme about to normalize spec located at wonderfulOAS.json +1ms
  rdme spec normalized +0ms
  rdme 👇👇👇👇👇 spec validated! logging spec below 👇👇👇👇👇 +115ms
  rdme {
 [TRUNCATED]
  rdme } +0ms
  rdme 👆👆👆👆👆 finished logging spec 👆👆👆👆👆 +5ms
  rdme spec type: OpenAPI +0ms
  rdme version in spec: 2024-01-09T09:02:37Z +0ms
  rdme spec bundled +18ms
  rdme making GET request to https://dash.readme.com/api/v1/version with headers: {"Authorization":["redacted"],"User-Agent":["rdme/8.6.6"],"x-readme-source":["cli"]} +1ms
  rdme received status code 200 from https://dash.readme.com/api/v1/version with JSON response: [{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"_id":"6596d7d30b01130054352655","createdAt":"2024-01-04T16:07:47.086Z"}] +293ms
  rdme selectedVersion: 1.0 +0ms
- Staging your API definition for upload...
  rdme creating temporary file at /var/folders/vp/mgz9jgsd615782vhc30q60380000gn/T/rdme-openapi--7162-rIv398kcxySH-.json +2ms
  rdme file and stream created, streaming into form data payload +2ms
  rdme making POST request to https://dash.readme.com/api/v1/api-registry with headers: {"Accept":["application/json"],"User-Agent":["rdme/8.6.6"],"x-readme-source":["cli"]} +2ms
  rdme received status code 201 from https://dash.readme.com/api/v1/api-registry with JSON response: {"registryUUID":"9i9y4qslr64oujz","definition":{[TRUNCATED]}} +2s
  rdme no id parameter, retrieving list of API specs +17ms
  rdme making GET request to https://dash.readme.com/api/v1/api-specification with headers: {"Authorization":["redacted"],"x-readme-version":["1.0"],"User-Agent":["rdme/8.6.6"],"x-readme-source":["cli"]} +0ms
  rdme total pages: 1 +720ms
  rdme pagination result: {"next":{"rel":"next","url":""},"prev":{"rel":"prev","url":""},"last":{"rel":"last","url":""}} +0ms
  rdme received status code 200 from https://dash.readme.com/api/v1/api-specification with JSON response: [{"title":"int-public.api.wattwin.com","source":"cli","_id":"ID_OF_THE_API_DEFINITION","version":"6596d7d30b01130054352655","lastSynced":"2024-01-09T09:06:40.168Z","category":{"title":"int-public.api.wattwin.com","slug":"slug-wonderfulOAS","order":9999,"_id":"6596dfc2dd9cd9002ac34916","type":"guide","id":"6596dfc2dd9cd9002ac34916"},"type":"oas","id":"ID_OF_THE_API_DEFINITION"}] +2ms
- Updating your API docs in ReadMe...
  rdme making PUT request to https://dash.readme.com/api/v1/api-specification/ID_OF_THE_API_DEFINITION with headers: {"Authorization":["redacted"],"accept":["application/json"],"content-type":["application/json"],"x-readme-version":["1.0"],"User-Agent":["rdme/8.6.6"],"x-readme-source":["cli"]} +1ms
✔ Updating your API docs in ReadMe... done! 🦉
  rdme received status code 200 from https://dash.readme.com/api/v1/api-specification/ID_OF_THE_API_DEFINITION with JSON response: {"_id":"ID_OF_THE_API_DEFINITION","title":"int-public.api.wattwin.com"} +5s
  rdme running GHA onboarding for openapi command +1ms
  rdme opts used in createGHA: {"key":"rdme_FOOKEY","spec":"wonderfulOAS.json","id":"ID_OF_THE_API_DEFINITION"} +0ms
  rdme [getGitData] isRepo result: true +26ms
  rdme [getGitData] rawRemotes result: origin
  rdme  +15ms
  rdme [getGitData] remote result: origin +0ms
Username for 'https://bitbucket.org': 

Thank you very much for your time and help.

kanadgupta commented 10 months ago

Hi @jirp-upc — it looks it's getting hung up on trying to retrieve some info about your local git configuration. Here are a few suggested workarounds:

  1. Run git remote show origin and then log in to Bitbucket. rdme won't have access to your git credentials — it's just doing an anonymous check to see if your git remote is GitHub or something else.
  2. Run rdme with the environmental variable CI=true (i.e., run CI=true rdme openapi wonderfulOAS.json ...)
  3. If your project is a JavaScript project and it uses a package.json, add an npm script that runs rdme and invoke rdme via that instead

Hope this helps. Let me know if you have any questions!

kanadgupta commented 6 months ago

Going to close this out since we haven't heard from you, but let us know if you're still seeing troubles with the workarounds I've provided!