Fala Devs!
Tenho uma consulta GraphQL que simplesmente parou de funcionar e começou a disparar um erro 403.
No header do Client utilizado pela consulta temos o VtexIdclientAutCookie com o ctx.authToken
, mas também tentei com ctx.adminUserAuthToken
e ctx.storeUserAuthToken
.
(...)
export class GiftCard extends ExternalClient {
constructor(ctx: IOContext, options?: InstanceOptions) {
super(`https://${ctx.account}.vtexcommercestable.com.br/api`, ctx, {
...options,
headers: {
...options?.headers,
...{ Accept: 'application/vnd.vtex.ds.v10+json' },
...{ VtexIdclientAutCookie: ctx.authToken },
},
})
}
(...)
Porém quando acesso a página que carrega a aplicação que usa esta consulta, me gera o erro abaixo:
{
"errors": [
{
"message": "Request failed with status code 403",
"path": [
"giftcard"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"message": "Request failed with status code 403",
"name": "ForbiddenError",
"status": 403,
"code": "FORBIDDEN",
"level": "warn",
"response": {
"data": "",
"headers": {
"date": "Thu, 08 Aug 2024 13:34:10 GMT",
"set-cookie": [
"janus_sid=984114e8-c4ed-470c-8849-6d571bc999b9; expires=Sun, 11 Aug 2024 13:33:42 GMT; domain=xpto.vtexcommercestable.com.br; path=/; samesite=lax"
],
"x-powered-by": "ASP.NET",
"x-vtex-janus-router-backend-app": "gcsapi-v1.20.1+442",
"x-vtex-operation-id": "dd809273-ecaa-4400-b3be-b3319cbcc98f",
"content-length": "0",
"connection": "Close"
},
"status": 403
},
"isAxiosError": true,
"sensitive": {
"config": {
"baseURL": "https://xpto.vtexcommercestable.com.br/api",
"data": "{\"client\":{\"id\":\"4d51ee02-7820-4267-ae6f-48f279235ec6\"}}",
"headers": {
"Accept": "application/vnd.vtex.ds.v10+json",
"Content-Type": "application/json;charset=utf-8",
"accept-encoding": "gzip",
"user-agent": "xpto.giftcard-points@0.3.8",
"x-forwarded-host": "temp--xpto.myvtex.com",
"x-vtex-tenant": "pt-BR",
"x-vtex-binding": "eyJpZCI6ImQyNWEzODkyLTQxNjUtNGNiNS05ODNiLTFiM2JiOWJkYWY3MSIsImxvY2FsZSI6InB0LUJSIn0=",
"x-vtex-locale": "pt-BR",
"x-vtex-operation-id": "dd809273-ecaa-4400-b3be-b3319cbcc98f",
"x-vtex-product": "store",
"x-vtex-segment": "eyJjYW1wYWlnbnMiOm51bGwsImNoYW5uZWwiOiIxIiwicHJpY2VUYWJsZXMiOm51bGwsInJlZ2lvbklkIjpudWxsLCJ1dG1fY2FtcGFpZ24iOm51bGwsInV0bV9zb3VyY2UiOm51bGwsInV0bWlfY2FtcGFpZ24iOm51bGwsImN1cnJlbmN5Q29kZSI6IkJSTCIsImN1cnJlbmN5U..",
"x-vtex-session": "eyJhbGciOiJFUzI1NiIsImtpZCI6IkVFQzY3MENDQUQ4Mjc4QzJGNUIxQUJERDNDREMxMDEyM0Y5RjkyM0YiLCJ0eXAiOiJqd3QifQ.eyJhY2NvdW50LmlkIjoiNTI0NDY0MzAtNzJiZS00MGZkLWE1MjEtZmRmMTE1YTA4NDAzIiwiaWQiOiIwODZmNGYzNC0zZTYzLTQ0YzEtYTBlMy05YWEzY2NlNGU2MDEiLCJ2ZXJzaW9uIjoxOCwic3ViIjoic2Vzc2lvbiIsImFjY291bnQiOiJzZXNzaW9uIiwiZXhwIjoxNzIzNzU4NjkyLCJpYXQiOjE3MjMwNjc0OTIsIm...",
"Content-Length": 56
},
"method": "post",
"timeout": 6000,
"url": "/giftcards/_search",
"params": {}
},
"request": {
"finished": true,
"method": "POST",
"path": "/api/giftcards/_search"
},
"stack": "Error: Request failed with status code 403\n at createError (/usr/local/app/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/app/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/app/node_modules/axios/lib/adapters/http.js:260:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"
}
}
},
"name": "GraphQLError",
"forwardedHost": "temp--xpto.myvtex.com",
"forwardedProto": "https",
"operationId": "dd809273-ecaa-4400-b3be-b3319cbcc98f",
"query": {
"query": "query getGiftcard {\n giftcard {\n code\n balance\n points {\n balance\n expiringDate\n __typename\n }\n vtexBalance\n __typename\n }\n}\n",
"operationName": "getGiftcard",
"variables": ""
```
{
"errors": [
{
"message": "Request failed with status code 403",
"path": [
"giftcard"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"message": "Request failed with status code 403",
"name": "ForbiddenError",
"status": 403,
"code": "FORBIDDEN",
"level": "warn",
"response": {
"data": "",
"headers": {
"date": "Thu, 08 Aug 2024 13:34:10 GMT",
"set-cookie": [
"janus_sid=984114e8-c4ed-470c-8849-6d571bc999b9; expires=Sun, 11 Aug 2024 13:33:42 GMT; domain=xpto.vtexcommercestable.com.br; path=/; samesite=lax"
],
"x-powered-by": "ASP.NET",
"x-vtex-janus-router-backend-app": "gcsapi-v1.20.1+442",
"x-vtex-operation-id": "dd809273-ecaa-4400-b3be-b3319cbcc98f",
"content-length": "0",
"connection": "Close"
},
"status": 403
},
"isAxiosError": true,
"sensitive": {
"config": {
"baseURL": "https://xpto.vtexcommercestable.com.br/api",
"data": "{\"client\":{\"id\":\"4d51ee02-7820-4267-ae6f-48f279235ec6\"}}",
"headers": {
"Accept": "application/vnd.vtex.ds.v10+json",
"Content-Type": "application/json;charset=utf-8",
"accept-encoding": "gzip",
"user-agent": "xpto.giftcard-points@0.3.8",
"x-forwarded-host": "temp--xpto.myvtex.com",
"x-vtex-tenant": "pt-BR",
"x-vtex-binding": "eyJpZCI6ImQyNWEzODkyLTQxNjUtNGNiNS05ODNiLTFiM2JiOWJkYWY3MSIsImxvY2FsZSI6InB0LUJSIn0=",
"x-vtex-locale": "pt-BR",
"x-vtex-operation-id": "dd809273-ecaa-4400-b3be-b3319cbcc98f",
"x-vtex-product": "store",
"x-vtex-segment": "eyJjYW1wYWlnbnMiOm51bGwsImNoYW5uZWwiOiIxIiwicHJpY2VUYWJsZXMiOm51bGwsInJlZ2lvbklkIjpudWxsLCJ1dG1fY2FtcGFZ24iOm51bGwsInV0bV9zb3VyY2UiOm51bGwsInV0bWlfY2FtcGFpZ24iOm51bGwsImN1cnJlbmN5Q29kZSI6IkJSTCIsImN1cnJlbmN5U3ltYm9sIjoiUiQiLCJjb3VudHJ5Q29kZSI6IkJSQSIsImN1bHR1cmVJbmZvIjoicHQtQlIiLCJhZG1pbl9jdWx0dXJlSW5mbyI6InB0LUJSIiwiY2hhbm5lFByaXZhY3kiOiJwdWJsaWMifQ",
"x-vtex-session": "eyJhbGciOiJFUzI1NiIsImtpZCI6IkVFQzY3MENDQUQ4Mjc4QzJGNUIxQUJERDNDREMxMDEyM0Y5RjkyM0YiLCJeXAiOiJqd3QifQ.eyJhY2NvdW50LmlkIjoiNTI0NDY0MzAtNzJiZS00MGZkLWE1MjEtZmRmMTE1YTA4NDAzIiwiaWQiOiIwODZmNGYzNC0zZTYzLTQ0YzEtYTBlMy05YWEzY2NlNGU2MDEiLCJ2ZXJzaW9IjoxOCwic3ViIjoic2Vzc2lvbiIsImFjY291bnQiOiJzZXNzaW9uIiwiZXhwIjoxNzIzNzU4NjkyLCJpYXQiOjE3MjMwNjc0OTIsImlzcyI6InRva2VuLWVtaXR0ZXIiLCJqdGkiOiIwOGI2Y2FmYi00NDhmLTRlOTYtYjQxYy03ODdkMTRlMjhlOGYifQ.OPyK_eZuEI0gL6C5vDe1ViWUXdn8Xfv9KGuLSLRLICnkRVw-dBOmazR3rBMPawA3Gk3t8IdoTg-FMFKu96_NKg",
"Content-Length": 56
},
"method": "post",
"timeout": 6000,
"url": "/giftcards/_search",
"params": {}
},
"request": {
"finished": true,
"method": "POST",
"path": "/api/giftcards/_search"
},
"stack": "Error: Request failed with status code 403\n at createError (/usr/local/app/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/app/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/app/node_modules/axios/lib/adapters/http.js:260:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"
}
}
},
"name": "GraphQLError",
"forwardedHost": "temp--xpto.myvtex.com",
"forwardedProto": "https",
"operationId": "dd809273-ecaa-4400-b3be-b3319cbcc98f",
"query": {
"query": "query getGiftcard {\n giftcard {\n code\n balance\n points {\n balance\n expiringDate\n __typename\n }\n vtexBalance\n __typename\n }\n}\n",
"operationName": "getGiftcard",
"variables": ""
},
"requestId": "0253b8cd2f0c4043a5411dec3cd5754d",
"pathName": "giftcard"
}
],
"data": {
"giftcard": null
}
}
O que será que está pegando?
Por que será que começou a gerar este erro?
Sugestões?