Createconfig() is not working if not in debug mode

Below createConfig() is failing if the app is not in debug mode:(in debug mode working fine)

await createConfig({
        clientId: CLIENT_ID,
        redirectUri: REDIRECT_URI,
        endSessionRedirectUri: END_SESSION_REDIRECT_URI,
        discoveryUri: DISCOVERY_URI,
        scopes: ['openid', 'profile', 'offline_access'],
        requireHardwareBackedKeyStore: REQUIRE_HARDWARE_BACKED_KEYSTORE,
        
      });

error log:

[Thu Dec 02 2021 19:18:31.985]  WARN     Possible Unhandled Promise Rejection (id: 2):
TypeError: undefined is not an object (evaluating 'window.location.protocol')
p@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:333439:53
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:349118:73
t@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:349122:12
createConfig$@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:332337:50
tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47881:23
invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:48054:32
tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47881:23
invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47954:30
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47984:19
tryCallTwo@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:49970:9
doResolve@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:50134:25
Promise@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:49993:14
callInvokeWithMethodAndArg@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47983:33
enqueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47988:157
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:48005:69
createConfig@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:332316:38
configCreator$@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:468909:85
tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47881:23
invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:48054:32
tryCatch@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47881:23
invoke@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47954:30
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47984:19
tryCallTwo@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:49970:9
doResolve@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:50134:25
Promise@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:49993:14
callInvokeWithMethodAndArg@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47983:33
enqueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:47988:157
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:48005:69
configCreator@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:468904:42
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:468933:20
commitHookEffectListMount@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:42535:38
commitPassiveHookEffects@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:42570:44
invokeGuardedCallbackImpl@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:32091:21
invokeGuardedCallback@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:32185:42
flushPassiveEffectsImpl@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:44914:36
unstable_runWithPriority@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:69422:30
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:44782:36
workLoop@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:69367:48
flushWork@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:69325:30
_flushCallback@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:68865:24
_callTimer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:53501:17
callTimers@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:53709:19
__callFunction@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:25771:36
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:25503:31
__guard@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:25725:15
callFunctionReturnFlushedQueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:25502:21

subsequent call - signInWithBrowser is also failing:

[Thu Dec 02 2021 19:30:34.918]  WARN     {"error_code": "-100", "error_message": "OktaOidc client isn't configured, check if you have created a configuration with createConfig"}

in package.json:

    "react": "16.13.1",
    "@okta/okta-react-native": "^2.2.0",

would you please help us fix this issue? can anyone guess why is it working only in debug mode?

we are trying to login with Okta in react native mobile app(both ios and android)

@phi1ipp @mraible @erik @andrea @Liliya

This looks like an issue to me:

TypeError: undefined is not an object (evaluating 'window.location.protocol')

Are you trying to use window.location in your properties? This will work in a web app, but not in a native mobile app.

We have not used window.** anywhere in react app, we are using @okta/okta-react-native": "^2.2.0 package and followed the npm documentation. strange thing is it is working in mobile app debug mode only. @mraible

Facing same Issue. Did you find any solution.