Changed handle in manifest

I changed our mini handle in manifest.json, which I’ve read in a couple posts causes token validation issues.

After doing so, before seeing the handle fix, I revoked the token and tried to regenerate a new one with npx shop-minis api-keys generate.

This didn’t work, so I did npx shop-minis setup to reset and then just read this undesirable!

Just looking for advice on how to move forward in this awkward state (old mini token revoked, just made a new mini).

Thanks,

Shane

If you have completed the setup with a new handle and you have the key in your .env file then I suggest just sticking with that. We don’t have a way to recover lost keys yet anyway

1 Like

I was still getting a “Mini not found” error when running generateUserToken:

  • I confirmed the API key is correct because it can access the admin api
  • I tried changing handle in the manifest.json, but this had no effect
  • I tried A/B testing the removal of parameters from manifest.json

:white_check_mark: I found that removing “handle” from manifest.json resolved the issue (the token generates and validates with the backend api).

:warning: I then tried to run npx shop-minis submit, just as a test, but received the error:

│  Manifest invalid. Errors:                                                      │                                                         
│    • Your manifest is missing a handle. Run `npx shop-minis setup` to generate your Shop Mini's handle                                                       │

An API key is tied to a handle so even if your key has API access it only works with the cli if you have the right handle set. It sounds as if you might have created several new keys/handles whilst playing around and you might now be in a bit of a broken state - I might suggest you just start a fresh mini if you don’t care about losing the handles you already created

1 Like

Thanks! I appreciate the advice.

That’s likely it. I definitely messed around with the manifest file when trying to rerun setup. I don’t recall exactly, but I think the command failed with the below whenever .handle was set:

error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Mini already set up                                                         │
│                                                                              │
│  Configuration already exists in `manifest.json`. Please set                 │
│  SHOP_MINIS_API_KEY in `.env` to set up this Mini.                           │
│                                                        

That’s what’s happening now on "@shopify/shop-minis-cli": "0.1.2", and it auto-generates a handle based on .name, but I don’t recall seeing that ~a week ago when I tried. Maybe it generated but I immediately replaced it.

Is there a way via the cli to get your handle from the API key? I looked around and tested some, but couldn’t find it.

So it turns out it was this:

  • handle automatically generated from .name
  • because the name was already taken from my initial mistake, it appended random characters ${name}-abcd
  • so just reusing name did work in this case, so we were able to keep the continuity of our review

P.S. @steve-t-shopify thanks for help, we got the email and resubmitted after fixing the few pieces of feedback! It was pretty minor and we’re around today for any follow-ups.

1 Like