# Uncaught Error: Invalid argument(s): Auth0Client has not been initialized

**URL:** <https://community.auth0.com/t/uncaught-error-invalid-argument-s-auth0client-has-not-been-initialized/150965>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, quickstarts-other\
**Created:** [November 4, 2024, 7:11pm UTC](https://community.auth0.com/t/uncaught-error-invalid-argument-s-auth0client-has-not-been-initialized/150965 "2024-11-04T19:11:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeshApps](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/meshapps/32/60259_2.png) [@MeshApps](https://community.auth0.com/u/MeshApps)\
**Post date:** [November 4, 2024, 7:11pm UTC](https://community.auth0.com/t/uncaught-error-invalid-argument-s-auth0client-has-not-been-initialized/150965/1 "2024-11-04T19:11:42Z")

</div>

Hello,

i’m currently facing an error regarding authentication with flutter web.

I am using the official package.

Sometimes the app build very long when also using the debugger. If using release mode it works directly.

If i build it and deploy it to an S3 Bucket (as a static website) i get this error when clicking the login button:

```auto
main.dart.js:5831 Uncaught Error: Invalid argument(s): Auth0Client has not been initialized
    at Object.c (main.dart.js:3364:19)
    at a9F.Hn (main.dart.js:45995:20)
    at a9F.MT (main.dart.js:45935:20)
    at main.dart.js:29408:14
    at aMB.a (main.dart.js:4730:63)
    at aMB.$2 (main.dart.js:40379:14)
    at Object.u (main.dart.js:4716:10)
    at Object.bfE (main.dart.js:29410:10)
    at Xl.aME (main.dart.js:29400:17)
    at Cg.VO (main.dart.js:104549:22)

```

I dont know how to provide any more detail to this, because it works in the local environment.

The way i use it is like this:

In my App (stateful widget) that is called by runApp() i have in my initstate this:

```auto
if (kIsWeb) {
      final auth0Web = ref.read(auth0WebInstanceProvider);

      auth0Web.onLoad().then(
        (final credentials) {
          if (credentials != null) {
            log("Logged in");
          } else {
            log("Logged out");
          }
        },
      ).onError(
        (error, stackTrace) {
          log(error.toString());
          log(stackTrace.toString());
        },
      );
    }

```

then im calling this on my on Pressed:

```auto
if (kIsWeb) {
    await ref.read(auth0WebInstanceProvider).loginWithRedirect(
          redirectUrl: dotenv.env['REDIRECT_URL']!,
        );
  }

```

and this is the auth0 provider:

```auto
final auth0WebInstanceProvider = Provider((ref) {
  return Auth0Web(
    dotenv.env['AUTH0_DOMAIN']!,
    dotenv.env['AUTH0_CLIENT']!,
  );
});

```

Does anyone have an idea or had a similar problem?

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [November 6, 2024, 6:59pm UTC](https://community.auth0.com/t/uncaught-error-invalid-argument-s-auth0client-has-not-been-initialized/150965/3 "2024-11-06T18:59:56Z")

</div>

Hi @MeshApps!

I understand your Flutter application works locally, but as a static website deployed to an S3 bucket, you get an `Uncaught Error: Invalid argument(s): Auth0Client has not been initialized` error. Can you provide the tenant name, client\_id, and the values of the env variables for both the working local version and the deployed version? You can send this information to me in a private message!

Best,

Mary Beth

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 20, 2024, 7:00pm UTC](https://community.auth0.com/t/uncaught-error-invalid-argument-s-auth0client-has-not-been-initialized/150965/5 "2024-11-20T19:00:28Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
