Issue with embedded SDK -

Xavier
Shopify Partner
3 0 1

hey there,

I'm trying out the EDSK and I'm having some basic problem I'm hoping someone can shed some light on...

my setup:

- I’m using the php lib from https://github.com/phpish/shopify

- installed my app for the store using the oath.php flow

- app is setup to use ESDK

- app url is /oauth.php which redirects to index.php that has the default init as described here: https://docs.shopify.com/embedded-app-sdk/initialization/

my issue:

ShopifyApp.ready() is called but when I try to make any calls to Shopify object nothing happens ( such as ShopifyApp.Bar.loadingOff) - I have the loading bar and spinning blue cursor going on for quite some time and nothing.

I tried to call ShopifyApp.Bar.initialize to setup some buttons but nothing shows up

Passing debug:true shows that the calls are made but with no results (console shows only things such as [Log] ShopifyApp client sent {"message":"Shopify.API.Bar.loading.off"} to https://mystore.myshopify.com (app.js, line 1)

Is my oauth dance incorrect? (I woudl expect the Shopify object to bark at me if it was the case...)

Thanks in advance for any suggestions you may have to debug this…

X

0 Likes

I have the excact same issue.

I also found this stackoverflow question, which seams to be the same or similiar issue: http://stackoverflow.com/questions/31491154/shopify-firefox-cant-establish-a-connection-to-the-serve...

0 Likes
James_Cateno
Shopify Partner
9 0 0

Hi Xavier, I have the same exact issue. I am developing with rails and hosting on heroku. The page loads in the embedded iframe and some rails api calls are made and show up. Yet nothing from the javascript api works. I can see the javascript is included and links to a proper file.

I know these are working from some tesing

ShopifyApp.init(); and ShopifyApp.ready();

But no calls such as ShopifyApp.flashNotice("Unicorn was created successfully."); or calls to initialize the bar work.

I wonder if it has something to do with being on heroku since the app is on a subdomain. I have spent almost the whole day trying to figure this out...it's very frustrating.

Did you every figure out the issue?

James

0 Likes

I changed a couple of things and thought i had figured it out, since the Shopify Javascript sdk works now for my app giveawayhero.

But I'm working on a second app, which I just deployed, and guess what... it is not working, again.

Will let you know if i'm able to fix it again.

 

[EDIT]

The issue has most likely something to do with ssl.

Make sure you:

  • Serve everything over https, your iframe, your javascript files, your stylesheets. everything
  • Make sure your have correctly installedyour ssl certificate: https://www.sslshopper.com/ssl-checker.html
  • Make sure, in your App's settings page, your "Application URL (required)" and your "Redirection URL (required)" both point to a https version of your website

For me it was the last point, this time...  :)

James_Cateno
Shopify Partner
9 0 0

Thank you for the updates. Thing is, the app as a whole is hosted at heroku and all the files are served via https. Calls via ruby work fine, it's all the js calls that fall.  Very frustrating.

0 Likes
asadkazmi
New Member
3 0 0

Many many thanks @Wolfram_Müller . Your answer resolve my problem.

This is very useful answer. I was facing the error with my embedded app SDK and googled a lot, but this answer resolve my problem.
What the issue I was facing?
I was able to create embedded app successfully but any thing which I was executing inside

ShopifyApp.ready(function(){
 // everything here was not working before
}) 

was not working. Because ShopifyApp.ready() was not working. So when I follow this answer and just change my app url and whitelist of redirect urls from http to https, every thing is now working. Many many thanks to @Wolfram_Müller 

0 Likes