watch実行時にエラー 422 - about.json が存在しません

Hello,

Hoping someone might be able to help here.

For context, I’ve picked up the current forum from a previous agency and I’ve not worked in Discourse prior to this week.

I need to make a modification to the theme (to fix the id:discourse.component-template-resolving notice).

I’ve followed the guide to setting up the CLI. I’ve managed to connect to the API and download the theme files.

However, when I try to run discourse_theme watch . I’m getting the following error:

✘ Error 422 for https://forum.mywebsite.co.uk/admin/themes/import.json: Import Error: about.json does not exist, or is invalid. Are you sure this is a Discourse Theme?

I have checked the following:

  • I’m operating from the correct folder.
  • about.json is named and formatted correctly
    • I have authors and the version numbers in there too
    • The encoding is correct
  • All directories exist

I thought possibly it could be the API permissions, but if I’m connected and the scopes in admin/api/keys/settings are correct and present, then surely it can’t be?

Basically, I’m stuck. Please can someone point me in the right direction?

「いいね!」 3

I remember something similar that was still an API problem: can you check the setting of your API key, it has to be set to global & set it to a specific user, not to all users.

「いいね!」 3

Hi Charlie,

Thanks for the reply. The API key that I was using was already set to global and to a specific user.

However, I have created 2 new ones against some moderators/admins (just in case it didn’t like the current admin user) and I’m having the same results again.

Thanks :slight_smile:

「いいね!」 1

Sorry just to update this, I’ve also created a brand new theme discourse_theme new <dir> and again it falls over when I run the watch command, so that rules out that there’s an issue with the theme (as you mentioned before)

「いいね!」 1

Unfortunately, that’s the extend of my “how-to-run” things setup knowledge :sweat_smile:

I’m sure a more knowledgeable person will be able to help you out soon.

I’ve mainly seen that error when trying to run the command on a plugin (which won’t work) but you say it’s a theme, or with maybe formatting errors in the .json, but you’ve checked that already… :thinking:

「いいね!」 2

Location may vary, but have you taken a look at your ~/.discourse_theme file?

I’ve run into an issue before where my terminal emulator was using “bracketed paste mode”

You can see the difference below (these aren’t real keys, I’ve truncated them for sharing)… if you see something like the first entry with escape characters, that’s incorrect and won’t work.

image

Hi Kris,

Thanks for the reply, I hadn’t thought of that!

I checked my discourse_theme file, and while the API key was formed properly, the file itself does look a bit malformed, compared to other examples I’ve seen (including yours).

Should be worth noting that I’m on macOS here and this was the result of cat ~/discourse_theme in iTerm.

"/Users/firstname.lastname/_dev/_dru/site-discourse-forum/src":
  url: https://forum.site.co.uk
  theme_id: 2
api_keys:
  ! '':
  https://forum.site.co.uk: [API_KEY]
"/Users/firstname.lastname/_dev/_dru/site-discourse-forum":
  url: https://forum.site.co.uk

I will proceed down the avenue of cleaning this up as this potentially could be a reason.

EDIT: Nope. Removed the ! ‘ ‘: and the second entry. Same thing. :melting_face:

「いいね!」 1