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

Phrase CLI returns unhelpful "ERROR: 404 Not Found" with no details #141

Closed
rlundy opened this issue Feb 27, 2024 · 11 comments
Closed

Phrase CLI returns unhelpful "ERROR: 404 Not Found" with no details #141

rlundy opened this issue Feb 27, 2024 · 11 comments

Comments

@rlundy
Copy link

rlundy commented Feb 27, 2024

I'm trying the command phrase push -w, and I get back

ERROR: 404 Not Found

If I use phrase push -w -v instead, I get more data [shown below, redacted], but still no useful error message:

>phrase push -w -v
&{Credentials:{Username: Token:[OMITTED] TFA:false TFAToken: Host:} Debug:true Page:<nil> PerPage:<nil> DefaultProjectID:[OMITTED] DefaultFileFormat: Defaults:map[] Targets:[OMITTED] Sources:[OMITTED] UserAgent:Phrase Strings CLI (2.22.0)}
ERROR: 404 Not Found

What would be more useful is an explanation of why the 404 happened. What address was I trying to reach that doesn't exist?

@rlundy
Copy link
Author

rlundy commented Feb 27, 2024

I tried Fiddler to see what URL it was trying to hit and there's nothing there, even if I tell it to intercept and decrypt HTTPS. When I run the Phrase CLI, it isn't making an entry in the Fiddler list.

@jablan
Copy link

jablan commented Feb 27, 2024

Hi @rlundy thanks for reporting this, the error is indeed not telling much. We will open an internal task to improve on this.

In the meantime, could you double check your project ID in your phrase.yml configuration?

@rlundy
Copy link
Author

rlundy commented Feb 27, 2024

I've confirmed that the project ID is correct. Our phrase.yml file looks like this (but with the correct project ID, of course):

phrase:
  project_id: REDACTED
  push:
    sources:
      - file: ./src/assets/locales/<locale_name>.json
        params:
          file_format: i18next
  pull:
    targets:
      - file: ./src/assets/locales/<locale_name>.json
        params:
          file_format: i18next

@jablan
Copy link

jablan commented Feb 27, 2024

Just to double check: a project with that ID exists on app.phrase.com (our EU app instance), not on us.app.phrase.com (or US instance)? Otherwise an appropriate API url has to be specified in the config as well.

@rlundy
Copy link
Author

rlundy commented Feb 27, 2024

Correct, we're using app.phrase.com, EU data center. We're based in Switzerland.

@rlundy
Copy link
Author

rlundy commented Feb 27, 2024

Doubtless worth noting is that some Phrase CLI commands do work correctly. If I use

phrase users user

for example, I do get back the details of my user.

@rlundy
Copy link
Author

rlundy commented Feb 27, 2024

I also tried adding host: to the .yml file:

phrase:
  host: https://api.phrase.com/v2/
  project_id: REDACTED
  [...etc...]

But this gave me the same results; phrase users user works but phrase push -w -v gives a 404 with no other info.

@jablan
Copy link

jablan commented Feb 27, 2024

@rlundy what about

phrase projects show --id ID_OF_YOUR_PROJECT

Does that work? 404 somehow still suggests that either project or locale id is wrong.

@rlundy
Copy link
Author

rlundy commented Feb 28, 2024

It turns out that another employee at our company decided, without notifying anybody, to revoke the API key because he thought we should be using an API key tied to his account instead of the account it was on. With the new non-revoked API key, I can now see the project by ID.

But there's still something for Phrase to fix here.

Where an API key is invalid, it ought to be showing us a 401, not a 404. Then at least we can be barking up the right tree when we look for a fix.

@rlundy
Copy link
Author

rlundy commented Jun 2, 2024

@theSoenke May I ask what the fix was?

@jablan
Copy link

jablan commented Jun 3, 2024

@rlundy we couldn't reproduce your case. When I try to perform a push (or, to keep it simple, projects show) using an invalid token, I'm getting 401 (you can try that yourself, by stripping your working token the last character for example).

Your 404s suggest to me that the token was still valid, but the user owning it didn't have the access to the project in question. So, from that perspective, it's just an unknown project and 404 would be a valid response.

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

3 participants