Skip to content

Commit

Permalink
bug fix: choose prod cookie in task and query service.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonkernel committed Sep 12, 2022
1 parent 2c80372 commit 0f15519
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/query/src/routes/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const SERVICE_POLICY = {
}
}

const PROD = process.env.ENV === 'PROD'
const COOKIE_JWT = PROD ? 'prodJWT' : 'stagingJWT'

const register = async (server, rpcPath, { seed, authMemberId, rpcEndpoint, projectId }) => {

const queryService = await queryBuilder.build({ seed, authMemberId, rpcEndpoint })
Expand All @@ -40,7 +43,7 @@ const register = async (server, rpcPath, { seed, authMemberId, rpcEndpoint, proj
const getJWT = (request) => {
// Try to get JWT from headers or cookie
const header = request.raw.headers.authorization
const cookie = request.cookies.stagingJWT
const cookie = request.cookies[COOKIE_JWT]
if (!header && !cookie) {
return
}
Expand Down
5 changes: 4 additions & 1 deletion packages/task/src/routes/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const SERVICE_POLICY = {
}
}

const PROD = process.env.ENV === 'PROD'
const COOKIE_JWT = PROD ? 'prodJWT' : 'stagingJWT'

const register = async (server, rpcPath, tasksPath, { seed, serviceAccount, faucetAmount, infuraId, authMemberId, rpcEndpoint, projectId }) => {

const taskService = await taskBuilder.build({ projectId, relativeUri: tasksPath })
Expand All @@ -56,7 +59,7 @@ const register = async (server, rpcPath, tasksPath, { seed, serviceAccount, fauc
const getJWT = (request) => {
// Try to get JWT from headers or cookie
const header = request.raw.headers.authorization
const cookie = request.cookies.stagingJWT
const cookie = request.cookies[COOKIE_JWT]
if (!header && !cookie) {
return
}
Expand Down

0 comments on commit 0f15519

Please sign in to comment.