My hasura server cannot access the jwk.json file. ...
# support-questions
My hasura server cannot access the jwk.json file. It says blocked by cors. Am I supposed to whitelist the auth domain also? I added dynamic domains in cors.
Copy code
  "type": "startup",
  "timestamp": "2022-07-01T15:17:06.143+0000",
  "level": "info",
  "detail": {
    "kind": "server_configuration",
    "info": {
      "live_query_options": {
        "batch_size": 100,
        "refetch_delay": 1
      "transaction_isolation": "ISOLATION LEVEL READ COMMITTED",
      "enable_maintenance_mode": false,
      "enabled_log_types": [
      "server_host": "HostAny",
      "websocket_connection_init_timeout": "WSConnectionInitTimeout {unWSConnectionInitTimeout = Seconds {seconds = 3s}}",
      "enable_allowlist": false,
      "remote_schema_permissions": false,
      "log_level": "info",
      "auth_hook_mode": null,
      "use_prepared_statements": true,
      "unauth_role": "anonymous",
      "stringify_numeric_types": false,
      "v1-boolean-null-collapse": true,
      "graceful_shutdown_timeout": 60,
      "enabled_apis": [
      "enable_telemetry": true,
      "enable_console": true,
      "auth_hook": null,
      "infer_function_permissions": true,
      "experimental_features": [],
      "enable_metadata_query_logging": false,
      "events_fetch_batch_size": 100,
      "jwt_secret": [
          "audience": null,
          "claims_format": "json",
          "claims_namespace": "",
          "header": null,
          "jwk_url": "https://auth-domain/auth/jwt/jwks.json",
          "issuer": null
      "cors_config": {
        "allowed_origins": "*",
        "disabled": false,
        "ws_read_cookie": null
      "websocket_compression_options": "NoCompression",
      "console_assets_dir": null,
      "admin_secret_set": true,
      "port": 17930,
      "websocket_keep_alive": "KeepAliveDelay {unKeepAliveDelay = Seconds {seconds = 5s}}"
This are logs from my hasura staging env
Production is fine
that's weird. It shouldn't be blocked by CORS since Hasura should just send a GET request to it
Can I see a screenshot of the error?
I send it to you in a PM
This seems like a CORS package issue.
Maybe it will help
IS this useful also? I dont fully understand it
Im not sure.
Probably open an issue on their lib
I am using
.split(", ");
to get an array from an env var
Consider printing out what domains you are setting
Im pretty sure it’s some input issue to the CORS lib
Is node 18 related?
I doubt it
What does your CORS lib usage look like?
I see. Can you make the cors not be dynamic and add the right URLs for your staging server just to see that it works that way. This way, we know that the issue for sure is to do with the function you implemented
I did and I still have the issue
I now can access the jwks.json file from browser
Right. So hasura should work too
And if you change it back to the dynamic conf, it stops working again?
MAde it work. Did many things like downgrading hasura to v2.8.0 and removing the custom domain (which I added after this problem)
Hmmm. Fair enough. This is quite strange indeed. But good to know
Also the auth app is still using the dynamic origins in cors
Hmmm. And that’s working?
It crashed again today, reverted back to static origin and worked. So that was the cause in the end..
Hmmm. Ok fair
@rp our staging hasura server crashed again. This time i had just an array in the origin.
Copy code
  "type": "jwk-refresh-log",
  "timestamp": "2022-07-05T16:18:14.975+0000",
  "level": "critical",
  "detail": {
    "error": {
      "http_exception": {
        "type": "http_exception",
        "message": "Response timeout",
        "request": {
          "secure": true,
          "path": "/auth/jwt/jwks.json",
          "responseTimeout": "ResponseTimeoutDefault",
          "queryString": "",
          "method": "GET",
          "requestHeaders": {
            "Content-Type": "application/json",
            "X-B3-ParentSpanId": "718481ff787b5cf6",
            "X-B3-TraceId": "e7f9c5f457b94921",
            "X-B3-SpanId": "bcf184352b6c3d65",
            "User-Agent": "hasura-graphql-engine/v2.8.3"
          "host": "",
          "port": 443
    "message": null
hmm. And it crashes just during this API call?
Yes it tries to get the JWK, receives no response, and then crashes
Yea. If you use the key string, it won't need to query the JWKS URL
But it shouldn't crash like this when it queries the API 🤔
What is crashing exactly? Your backend process? Or the supertokens-core?
The Hasura server is crashing, which is hosted in heroku. And only the staging server, which goes idle much often
Also I am fetching the jwks.json from my auth api as described in the docs. Not directly from supertokens-core. Is this correct?
yes. that is correct
it's really strange that this is happening
no other API has this behaviour?
Afaik no. Hasura is the only api we use
right. It could be an issue not related to supertokens, just the way the process is setup
I ll try the string tomorrow. That's what I jad before moving to supertokens
Yea. That can work too
But this might hint at a deeper problem with how the process is being run on the server
In the docs it says to get the keys from supertokens core, are the keys from our auth server jwks.json the same?
Ok I ll also post on Hasura
Yes. They are the same
the api server just queries the core to get them
> Ok I ll also post on Hasura I don't think the issue is to do with Hasura, but rather how the api process is being run on the server
Something about being idle makes it unresponsive
I changed to a key string. I ll let you know if it happens again.