How to disable embedded app setting in Rails shopify_app gem?

Highlighted
New Member
1 0 1

Hello,

I am using Ruby on rails with shopify_app gem. I have initialized everything as mentioned in Readme. The embedded app is working as expected. I am trying to open the Shopify app on a standalone page and not inside Shopify admin. 

Things I have tried:

1. By setting `config.embedded_app = false` in shopify_app.rb. 

2. I have also disabled the "Embed your app" setting in app dashboard. (Extensions -> Embedded App)

After the above steps, the app is successfully redirecting to out of Shopify admin page but nothing shows up

In the console, it is throwing an error on line 2 of `shopify_app.js` 

Error: 

Uncaught TypeError: Cannot read property 'dataset' of null
at HTMLDocument.<anonymous> (shopify_app.js:2)

shopify_app.js :

 

 

document.addEventListener('DOMContentLoaded', () => {
var data = document.getElementById('shopify-app-init').dataset
var AppBridge = window['app-bridge']
var createApp = AppBridge.default
window.app = createApp({
apiKey: data.apiKey,
shopOrigin: data.shopOrigin,
})

var actions = AppBridge.actions
var TitleBar = actions.TitleBar
TitleBar.create(app, {
title: data.page,
})
})

 

I am confused currently about how to move forward. would really appreciate your help. Many thanks in advance.