https://supertokens.com/ logo
Title
s

Sourabh Kumawat

10/05/2022, 7:31 AM
Hey I am facing a issue with supertoken today, can someone help me out
{
  "statusCode": 500,
  "error": "Internal Server Error",
  "message": "SuperTokens core threw an error for a POST request to path: '/recipe/jwt' with status code: 500 and message: Internal Error\n"
}
is someone aware about this error? i am using
"supertokens-node": "9.1.2",
version of super token and method which is throwing the error is
import Session from 'supertokens-node/recipe/session'
Session.createJWT(JWT, JWT_EXPIRE_TIME)
r

rp

10/05/2022, 7:32 AM
Hey! What payload are you giving to that function?
s

Sourabh Kumawat

10/05/2022, 7:32 AM
its a JWT payload and the expiration time
r

rp

10/05/2022, 7:33 AM
What’s the content of the JWT payload?
s

Sourabh Kumawat

10/05/2022, 7:33 AM
it was working earlier today but seems like breaking now with 500 internal server error
r

rp

10/05/2022, 7:34 AM
This is the error the core throws:
java.lang.IllegalArgumentException: Claim values must only be of types Map, List, Boolean, Integer, Long, Double, String and Date",
Thats why i asked whats the contents of the JWT payload that you are giving?
s

Sourabh Kumawat

10/05/2022, 7:34 AM
let me see
it is a object with key value pairs which has string data
r

rp

10/05/2022, 7:37 AM
Object as in a JSON object? Or a JS class?
s

Sourabh Kumawat

10/05/2022, 7:37 AM
JSON object
r

rp

10/05/2022, 7:37 AM
Can you show me an example?
s

Sourabh Kumawat

10/05/2022, 7:41 AM
{
  "http://example.com": {
    "modules": "{DASHBOARD:['READ','WRITE','DELETE','SHARE','PUBLISH']}",
    "roles": [
      "public"
    ],
    "id": "6fe23949-1c71-4a56-847e-83bba6b6f0d"
  }
}
@rp
?
r

rp

10/05/2022, 7:50 AM
hmm
@nkshah2 can help here
s

Sourabh Kumawat

10/05/2022, 7:51 AM
okay waiting for your reply @nkshah2
r

rp

10/05/2022, 7:52 AM
i think this might be an issue in the core. We will investigate
s

Sourabh Kumawat

10/05/2022, 7:53 AM
can you give me a tentative timeline for this , as it is affecting many things ?
n

nkshah2

10/05/2022, 7:53 AM
I’m currently investigating the issue, I’ll get back to you in a bit
s

Sourabh Kumawat

10/05/2022, 7:53 AM
okay
r

rp

10/05/2022, 7:53 AM
sometime today /tomorrow we should be able to provide a fix.
s

Sourabh Kumawat

10/05/2022, 7:54 AM
okay thankyou
r

rp

10/05/2022, 8:05 AM
How are you using the SDK function? It's working for me:
jwt = await JWTRecipe.createJWT({
                "http://example.com": {
                    "modules": "{DASHBOARD:['READ','WRITE','DELETE','SHARE','PUBLISH']}",
                    "roles": ["public"],
                    "id": "6fe23949-1c71-4a56-847e-83bba6b6f0d"
                }
             }, 1000);
@Sourabh Kumawat
s

Sourabh Kumawat

10/05/2022, 8:16 AM
import Session from 'supertokens-node/recipe/session'
this is the import
this is the function
Session.createJWT(JWT, JWT_EXPIRE_TIME)
'Error: Request failed with status code 500
    at createError (/node_modules/supertokens-node/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/node_modules/supertokens-node/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/node_modules/supertokens-node/node_modules/axios/lib/adapters/http.js:269:11)
    at /node_modules/elastic-apm-node/lib/instrumentation/run-context/AbstractRunContextManager.js:76:49
    at AsyncHooksRunContextManager.with (/node_modules/elastic-apm-node/lib/instrumentation/run-context/BasicRunContextManager.js:59:17)
    at IncomingMessage.wrapper (/node_modules/elastic-apm-node/lib/instrumentation/run-context/AbstractRunContextManager.js:76:23)
    at IncomingMessage.emit (node:events:402:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)'
this is the stack
r

rp

10/05/2022, 8:20 AM
doing it via
Session.createJWT
works for me as well
Are you sure the value of
JWT
that you give is what you sent above?
Cause i literally just tried that, and it works
Also, can you try querying the latest version of the core and seeing if this error still happens there?
also, you said that it used to work. What changed?
we are also happy to jump on a call if that helps @Sourabh Kumawat
s

Sourabh Kumawat

10/06/2022, 5:07 AM
can we jump on a call ?
r

rp

10/06/2022, 5:17 AM
@nkshah2 can help out
s

Sourabh Kumawat

10/06/2022, 5:22 AM
@nkshah2 what is the size limit for JWT?
n

nkshah2

10/06/2022, 5:24 AM
I think itll be easier on call, ill send you a link
@Sourabh Kumawat
To summarise the issue, the problem was that a
null
value was being added to the JWT payload which is not considered a valid claim
Feel free to revive this thread or start a new one if you face more issues
s

Sourabh Kumawat

10/06/2022, 5:53 AM
thankyou for your help @nkshah2 @rp
n

nkshah2

10/06/2022, 6:20 AM
Happy to help