shopify_app + Heroku 500 error on callback

Highlighted
Shopify Partner
55 2 7

I've created a shopify app that works perfectly when run locally. I deployed it to Heroku, but when I try to install the app I get an error "We're sorry, but something went wrong."

The heroku log shows: 

2019-01-05T04:03:01.084275+00:00 heroku[router]: at=info method=GET path="/auth/shopify/callback?code,4ae72e65059346f271af377780b4d590&hmac,bf26bbf62008e5d118820f41e6edc59122bc69f9d8271a66a8db3e086bd2a35c&shop,product-add-ons.myshopify.com&state,3b583e1fd85abf3b07017f695f4c9d3da06e73ca461e0a69&timestamp,1546660976" host=product-add-ons.herokuapp.com request_id=23c5ef76-bdf5-47ed-9aae-52df7352d4bb fwd="98.207.48.51" dyno=web.1 connect=1ms service=4236ms status=500 bytes=1827 protocol=https

I thought it might have somthing to do with the ShopifyApp::SessionRepository. However, I ran the shop model generator and it still doesn't work.

My shop.rb is:

class Shop < ActiveRecord::Base
  include ShopifyApp::SessionStorage  
end

and my shopify_app.rb is:

ShopifyApp.configure do |config|
  config.application_name = "Product Add-Ons"
  config.api_key = <KEY>
  config.secret = <SECRET>
  config.scope = "read_products, write_products, read_script_tags, write_script_tags"
  config.embedded_app = true
  config.after_authenticate_job = false
  config.session_repository = ::Shop
  config.webhooks = [
    {topic: 'app/uninstalled', address: '/uninstall'}
  ]
end
  

Do I need more code in shop.rb? I thought everything was handled in SessionStorage. I'm very lost, and any help would be greatly appriciated. :)

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1555 81 282

I'm not sure if this is the exact callback URL but it looks like the parameters are separated by commas? If that's the case I imagine it would definitely be part of the problem. What version of ShopifyApp, Ruby, and Rails are you running? Does this occur when you run it locally behind a tunnel as well?

With the above info I can attempt to replicate locally.

Cheers.

0 Likes
Highlighted
Tourist
5 0 1

Hi Alex,

I am new to shopify app development and facing same issue as mention in question above. Url return when I try to install app to a shop is as follows:

https://staging-shopify-app.herokuapp.com/auth/shopify/callback?code=a05ed914b7dd6dbb6d4284a9950a228...

 

You can try to regenerate this here: https://staging-shopify-app.herokuapp.com/login

Thank you,

0 Likes
Highlighted
Shopify Expert
4175 29 400

That is not exactly a helpful error message from Heroku. You should look closer in your logs for the actual problem. Only then will you know what to fix. The first thing I do when I deploy to Heroku is heroku addons:create papertrail so that I can scan logs for errors much easier than CLI.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Highlighted
Tourist
5 0 1

Thank you for your response.

Below is from heroku logs and "Something went wrong" is displayed in browser.

2020-02-07T06:36:43.077514+00:00 heroku[router]: at=info method=GET path="/login?shop=bhatti-development-store.myshopify.com" host=staging-shopify-app.herokuapp.com request_id=b35e9e71-a38f-4583-abce-2f7b362c0c94 fwd="119.155.13.226" dyno=web.1 connect=0ms service=12ms status=304 bytes=809 protocol=https
2020-02-07T06:36:43.368704+00:00 heroku[router]: at=info method=GET path="/auth/shopify?shop=bhatti-development-store.myshopify.com" host=staging-shopify-app.herokuapp.com request_id=811dbf9c-9bd5-4e38-bde9-49ba749229e1 fwd="119.155.13.226" dyno=web.1 connect=0ms service=10ms status=302 bytes=1618 protocol=https
2020-02-07T06:36:44.802476+00:00 heroku[router]: at=info method=GET path="/auth/shopify/callback?code=4286ea09062c97bf6e0ae6acd24498f1&hmac=1ef2d49cea30c61fd65bf4878c1404c716e2a5c75471bbd04392c13b32c72290&shop=bhatti-development-store.myshopify.com&state=5371f02a18df8d3e4a9e4b280402b7243693d38c123d654b&timestamp=1581057404" host=staging-shopify-app.herokuapp.com request_id=f93d1048-6f0e-4469-8a06-3a274b40d693 fwd="119.155.13.226" dyno=web.1 connect=1ms service=241ms status=500 bytes=1754 protocol=http
0 Likes
Highlighted
Tourist
5 0 1

@HunkyBill wrote:

That is not exactly a helpful error message from Heroku. You should look closer in your logs for the actual problem. Only then will you know what to fix. The first thing I do when I deploy to Heroku is heroku addons:create papertrail so that I can scan logs for errors much easier than CLI.


hey Bill,

This is error returned.

ArgumentError in ShopifyApp::SessionsController#callback

wrong number of arguments (given 2, expected 0; required keywords: domain, token, api_version)

 

I understand it has to do with with initiating sessions call but don't know where I should do it. I have ran sessions generator and shopify::sessionscontroller is created but need help how and where to change.

Thank you,

Ahmed

0 Likes