This repo creates a reduced test case for a 500
error that happens at the same time as any invalid token error.
More details can be found in this issue: Shopify/shopify_app#1536
To get set up with this repo, clone and then:
- Run
bundle install
- Create an app in the Shopify Partners dashboard
- Create a
.env
file in the root of the project and add the following credentials
HOST=http://localhost:3000
SHOPIFY_API_KEY=<Your Shopify API key>
SHOPIFY_API_SECRET=<Your Shopify API secret>
- Run the migrations
rails db:migrate
- Run the app
rails server
- Go to
http://127.0.0.1:3000
The app will attempt to fetch a list of products in the ProductsController
that inherit from the AuthenticatedController
. In app/views/home/index.html.erb
I am purposely using an invalid token.
On the server side, in AuthenticatedController
I am trying to rescue this error and return a 400
error. Eventually, this would be a 401
error to which I would add a re-authentication header. Unfortunately, I can't because it gets overridden by a server (500
) error (see the error mentioned above for a full stack trace). I have tried rescuing from the ApplicationController
without luck as well.
I've noticed that sometimes there is another error that happens on the client side even before the fetch. If this happens, just refresh.