Search code examples
jwthasurahasura-jwthasura-docker

Issue configuring JWT secret with claims_map in Hasura Docker compose


I am trying to set claims_map in HASURA_GRAPHQL_JWT_SECRET in my docker compose file using the below config

HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256","key":"***************************","claims_namespace":"p-clamis-allow","claims_map":{"x-hasura-user-id":{"path":"$.user.id"}}}'

I get the following error:

Invalid interpolation format for "environment" option in service "graphql-engine":"{"type":"HS256","key":"*************************","claims_namespace":"p-clamis-allow","claims_map":{"x-hasura-user-id":{"path":"$.user.id"}}}"**


Solution

  • Replace $ with $$ and things should work!

    HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256","key":"***************************","claims_namespace":"p-clamis-allow","claims_map":{"x-hasura-user-id":{"path":"$$.user.id"}}}'