Why am I getting a cache error in my script tag code?

Solved

Why am I getting a cache error in my script tag code?

EugeneCXY
Excursionist
16 3 4

I am currently getting an error when I add cache: true. Without the cache, it is working.

I get this error 

EugeneCXY_1-1627422752907.png

 

Here is my code

import gql from "graphql-tag";
import { useQuery, useMutation} from "react-apollo";
import { Button} from "@shopify/polaris";
import React from "react";


const CREATE_SCRIPT_TAG = gql`
  mutation scriptTagCreate($input: ScriptTagInput!){
    scriptTagCreate(input: $input){
      scriptTag{
        id
      }
      userErrors{
        field
        message
      }
    }
  }

`

function Index() {
  const [createScripts] = useMutation(CREATE_SCRIPT_TAG)


  return(
            <Button
              primary
              size="slim"
              type="submit" onClick={()=>{
                createScripts({
                  variables: {
                    input: {
                      cache: true,
                      src: "https://3b1087910eb7.ngrok.io/thanks-script.js",
                      displayScope: "ORDER_STATUS"
                    },
                  },
                  refetchQueries: [{query: QUERY_SCRIPTTAGS}]
                })
              }}>
                  Create Code
            </Button>

         
               

  )
}


export default Index;

 

 

Accepted Solution (1)

EugeneCXY
Excursionist
16 3 4

This is an accepted solution.

It was the shopify API version. Was using last years version... Changed it to  

  API_VERSION: ApiVersion.April21
 

View solution in original post

Reply 1 (1)

EugeneCXY
Excursionist
16 3 4

This is an accepted solution.

It was the shopify API version. Was using last years version... Changed it to  

  API_VERSION: ApiVersion.April21