0
votes

I've create a Ruby on Rails app using the shopify_app gem which is being hosted on heroku. It is a simple form that queries a pg database and returns a table of results posted to the same path. It works perfectly on heroku but I'm trying to figure out why on my shopify site's proxy, only the initial get request for the path works but when it tries to render the view with the search results post requested to the same path, shopify says 'page not found'. Here is a link to the app on heroku: https://rails-test-app4.herokuapp.com/proxy-test and the app on shopify: https://deltachildren-content.myshopify.com/apps/proxy-test

1
I'm seeing the result "Product not found.. call customer service.." on both pages. Any test data you can share?HymnZzy
Hi @HymnZ! I changed the post to a get request and I have an if statement in the controller action that renders the index view if parameter values are present but I would prefer to make it work with two different actions. Do you know if this is a limitation of shopify proxies? That they can only serve one action/request type per proxy. I am already using only one path since the proxy doesnt seem to support any extensions in the path.Tatiana Frank
No. Technically there are no limitations. App proxy is just for URL masking. Are you passing the POST request to this type URL? https://MyApiKey:[email protected]HymnZzy
@HymnZ no I just have a route in my config/routes /apps/proxy-test which works for the get request just not post. how would I post it the way you are suggesting?Tatiana Frank
Okay. I understand it now. Please check the answer.HymnZzy

1 Answers

0
votes

From our discussion in the comments, I understand this (do correct me if I am wrong):

  1. You have setup an app on Heroku and you're using it to control the data from your Shopify store.
  2. You've setup an app proxy on Shopify with /apps/* path and linked it to the app on Heroku.
  3. You're able to retrieve (GET) information on to the app (say webpage) but you're unable to post new or modify the information (POST/PUT/DELETE).

That's not how an app proxy works. App proxy is used for get the information from the original app and then pass it through Shopify servers, render any liquid code and display it to the user. More details on it here - Application Proxies: The New Hotness

Retrieving information is fairly straight forward as long as it is within the formal limits (basic information that don't require API authentication) of the Shopify or third-party external sites (bypassing CORS and iframe issues). If you want to get more detailed information you need to make RESTful calls from you app on Heroku to Shopify store.

There are specific guides for each API endpoint required and how to implement them using Ruby on Rails, but here's a direction to start at - How to get to everything using Ruby on Rails

Hope it helps.