Hey I am facing a issue with supertoken today, can someone help me out ```{"statusCode":500,"error"...
s
Hey I am facing a issue with supertoken today, can someone help me out
Copy code
{
  "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
Copy code
"supertokens-node": "9.1.2",
version of super token and method which is throwing the error is
Copy code
import Session from 'supertokens-node/recipe/session'
Session.createJWT(JWT, JWT_EXPIRE_TIME)
r
Hey! What payload are you giving to that function?
s
its a JWT payload and the expiration time
r
What’s the content of the JWT payload?
s
it was working earlier today but seems like breaking now with 500 internal server error
r
This is the error the core throws:
Copy code
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
let me see
it is a object with key value pairs which has string data
r
Object as in a JSON object? Or a JS class?
s
JSON object
r
Can you show me an example?
s
Copy code
{
  "http://example.com": {
    "modules": "{DASHBOARD:['READ','WRITE','DELETE','SHARE','PUBLISH']}",
    "roles": [
      "public"
    ],
    "id": "6fe23949-1c71-4a56-847e-83bba6b6f0d"
  }
}
@rp_st
?
r
hmm
@nkshah2 can help here
s
okay waiting for your reply @nkshah2
r
i think this might be an issue in the core. We will investigate
s
can you give me a tentative timeline for this , as it is affecting many things ?
n
I’m currently investigating the issue, I’ll get back to you in a bit
s
okay
r
sometime today /tomorrow we should be able to provide a fix.
s
okay thankyou
r
How are you using the SDK function? It's working for me:
Copy code
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
Copy code
import Session from 'supertokens-node/recipe/session'
this is the import
this is the function
Copy code
Session.createJWT(JWT, JWT_EXPIRE_TIME)
Copy code
'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
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
can we jump on a call ?
r
@nkshah2 can help out
s
@nkshah2 what is the size limit for JWT?
n
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
thankyou for your help @nkshah2 @rp_st
n
Happy to help
57 Views