Script Tag routing issue.

PurpleMamba
Shopify Partner
89 1 8

I have a scripttag that I load into the store using the shopify_app initializer within my app like this:

config.scripttags = [{event: 'onload', src: "https://theappname.herokuapp.com/scripts/myscript.js"}]

On the store-side I get this message in the console:

Loading failed for the <script> with source “https://theappname.herokuapp.com/scripts/myscript.js?shop=theshopname.myshopify.com”.

In the app logs I get this error:

ActionController::RoutingError (No route matches [GET] "/scripts/myscript.js")

Does ScripttagsManager not handle routing for the script tag in the same way that WebhooksManager does?

Do the routes have to be created manually for each script tag?

What am I missing here?

0 Likes
PurpleMamba
Shopify Partner
89 1 8

Can anyone help with this? Or can anyone suggest another way to properly load Script Tags?

0 Likes
prativa
New Member
4 0 0

I was having the same problem so I transferred the script to public/ file and it's working now. But I don't want it to have it in the public folder,  I want it inside my javascript folder. What do I need to do to achieve that?  I am using rails 6 with webpacker. @_JB Could you please help me here ? 

0 Likes