Uncaught TypeError: Super expression must either be null or a function

After making production build i am getting this error in console and application is not getting loaded.

image

My Environment:

OS: Linux/Ubuntu
React version: 16.13.0
@okta/okta-auth-js: 5.2.2
@okta/okta-react: 6.0.0
@okta/okta-signin-widget: 5.5.0

@sarmad Can you please check the solution discussion here and see if it helps.

I have already seen that but couldn’t get any luck.
let me know the is Okta version i have mentioned above does support React version 16.13.0?

Hi @sarmad, maybe u can update your babel-eslint version to the latest one, I got this problem as well and after updating babel-eslint it fixes.

1 Like

Is there any other solution to solve this? I still having the same problem after making production build, update the babel-eslint do not work for me

Hey @chunshien , After updating the babel-eslint the issue still persisted. So what i have done is i just attached the cdn of okta-auth-js library in to my index.html file as an external javascript file. this way it was available in my window object.

Hi @sarmad, I have tried your way to include okta-auth-js CDN link in my index.html but it still not works after the production build.

I am attached below CDN in my index.html:
β€˜https://global.oktacdn.com/okta-auth-js/5.3.1/okta-auth-js.min.js’

Okta version in Package.json
β€œreact”: β€œ^16.8.3”,
β€œ@okta/okta-auth-js”: β€œ^5.3.1”,
β€œ@okta/okta-react”: β€œ^6.1.0”,

Hey @chunshien , This is the version i have used, Also initialize your okta in the html file

  <script
      src="https://global.oktacdn.com/okta-auth-js/4.5.0/okta-auth-js.min.js"
      type="text/javascript"
    ></script>
    <script>
        window.myOkta = new OktaAuth({
          clientId: "",
          issuer: "",
          redirectUri: "",
          scopes: ["openid", "profile", "email"],
          pkce: true,
          disableHttpsCheck: false,
          authParams: {
            issuer: "",
            responseType: ["id_token", "token"],
          },
        })
    </script>```

This way you will have myOkta variable in your window object and you can use it to redirect.
Also you will have to delete all the pakcages u have installed related to okta and delete node_module as well and install it again.

@sarmad I think my problem is because of the react-script version, now I upgrade to 4.0.3 which used in the okta sample-js-react so now it can work without the error. Conclusion, latest okta-auth-js is not backward support older react-script version.

does it work now by by updating the react-script?

@sarmad, it is works with updating the react-script but you might facing a lot linter issue if you are now on older eslint version which need to refactor.

1 Like

ooh okay, well i have used it by the approach i just shared and its working fine in my case without updating anything.