How to remove script files from shopify assets folder when the owner uninstalls the app

badgeAppTester_
Shopify Partner
19 0 5

Hi,

 

I have app where we inject script into merchant assets folder. In script file we make ajax call to get some data from our server.

 

But when merchant uninstalls the app we are not able to delete the script files from the assets folder. So, even after the app is uninstalled script file will make ajax call to our server. So roughly we will be getting more than 50 calls from single merchant who have uninstalled our app, every day. We are able to see the even 1000 calls being made per second. Thsi can badly impact the infrastructure going forward as the customer base increases.

Is there any way to remove script file from the assets folder or stop making ajax call from the script file once the merchant uninstalls our app?

 

Thanks...

Replies 5 (5)
_JB
Shopify Staff
834 99 190

Hey @badgeAppTester_,

 

When an app is uninstalled, any script tags generated by the app are automatically removed.

 

I believe this functionality was introduced in 2017, so it's possible that old script tags are still existing if the app was uninstalled before then. Can you confirm when the affected shops originally uninstalled your app?

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

badgeAppTester_
Shopify Partner
19 0 5

We are not using script tags we inserting our script file into assets folder of the store owner. Is there any way to remove script file from the asset folder

oneezy
Excursionist
15 1 4

Hi, I'm actually having a similar problem.

 

I used the GraphiQL App to write a mutation for scriptTagCreate so I can test adding in a custom script tag, and after uninstalling the app the script tags are still in my store.

 

MUTATION

mutation exampleScriptTagCreate($input: ScriptTagInput!) {
  scriptTagCreate(input: $input) {
    userErrors {
      field
      message
    }
    scriptTag {
      src
      displayScope
    }
  }
}

QUERY VARIABLES

{
  "input": {"src": "https://example.com/script.js", "displayScope": "ONLINE_STORE" }
}

Now I'm trying to figure out how to remove these Script Tags with another Mutation but I'm having trouble doing so.

 

oneezy
Excursionist
15 1 4

Doh!! I solved my problem. I was using the GraphiQL App to insert ScriptTags but I was trying to uninstall MY ACTUAL APP and expecting it to work. Uninstalling the GraphiQL App worked like a charm.

 

Dumb mistake on my part... (I'm new)

jec5789
Tourist
4 1 2

Hello,

Is it possible to remove the Graphql App by API call?