SecurityContext in CompileContext

Hi,
I am new to forum and CubeJS. I have an issue with cubeJS and can’t resolve it.
I have to get securityContext inside a cube. But when I check the logs the securityContext in CompileContext is empty and an error is shown:
{“message”:“Refresh Scheduler Error”,“error”:“TypeError: Cannot read property ‘split’ of undefined\n at sql (Formulas.js:147:37)\n at CubeEvaluator.resolveSymbolsCall (/cube/node_modules/@cubejs-backend/schema-compiler/src/compiler/CubeSymbols.js:142:22)\n at MysqlQuery.evaluateSql (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1492:26)\n at MysqlQuery.evaluateSymbolSql (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1429:32)\n at MysqlQuery.traverseSymbol (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1182:35)\n at /cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1220:31\n at MysqlQuery.evaluateSymbolSqlWithContext (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1578:22)\n at MysqlQuery.collectCubeNamesFor (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1524:10)\n at /cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/BaseQuery.js:1220:17\n at CompilerCache.cache (/cube/node_modules/@cubejs-backend/schema-compiler/src/adapter/QueryCache.js:22:28)”,“securityContext”:{},“requestId”:“scheduler-ca49731c-4cad-427b-9c74-f844b3675bd7”}

Can you please suggest me a way how to refresh or get the securitContext from a cube file?

Hi @A.F_M !
JWTs sent to Cube.js should be passed in the Authorization: < JWT > header to authenticate requests. Please, make sure this part is configured properly.
https://cube.dev/docs/security/context

Could you share some more info about your setup, please?

This is how I send the jet to CubeJs API:
this.cubejs = cubejs(

  •                async () => res['token'],*
    
  •                { apiUrl: environment.cubeAPI }*
    
  •            );*
    

Also, in the query rewrite the SecurityContext is okay, only on compileContext it is not updated or sometimes it is missing