Are some queries/mutations restricted?
codan84
FREEOP

13 days ago

I am running a serviceInstance query with project token header set, but I am getting unauthorised. I can run project query with the same token/auth. Here's the query and response error.
Query:

query serviceConfiguration($environmentId: String!, $serviceId: String!) {
  serviceInstance(environmentId: $environmentId, serviceId: $serviceId) {
    id
    serviceName
    createdAt
    deletedAt
    cronSchedule
    healthcheckPath
    healthcheckTimeout
    isUpdatable
    numReplicas
    region
    source {
      image
      repo
    }
  }
}

Variables:

{"environmentId":"<>","serviceId":"<>"}}

Response:

[
  {
    "message": "Not Authorized",
    "locations": [
      {
        "line": 3,
        "column": 3
      }
    ],
    "path": [
      "serviceInstance"
    ],
    "extensions": {
      "code": "INTERNAL_SERVER_ERROR"
    },
    "traceId": "4066275895323198068"
  }
]
$10 Bounty

12 Replies

https://railway.com/graphiql
I don't think serviceConfiguration is a valid query?


What are you trying to do?


codan84
FREEOP

13 days ago

You are right, it’s serviceInstance. I’ll try this when I’m on the laptop. Unsure where I got the serviceConfiguration but I’ll find out


codan84
FREEOP

13 days ago

Well, actually, the first name (serviceConfiguration) is my local name (or label) for the operation I want to do, inside you can see the call to serviceInstance query. That label does not have to tie it to the schema. The actual query name inside is correct.


nvm i see it now


@codan84 What headers are you using to authenticate with the API using a project token?


codan84
FREEOP

12 days ago

Project-Access-Token. As I have said, I can run a project query just fine:

query project($id: String!) {
    project(id: $id) {
      ...ProjectFields
    }
  }

  fragment ProjectFields on Project {
    id
    name
    description
    createdAt
....

Well, I'm not too sure. I copied your original query and the fragment query and I could run it just fine on my end as well…


I'd probably make sure your environment and service IDs are correct.


codan84
FREEOP

12 days ago

Are you using project scoped token or workspace one?


codan84
FREEOP

12 days ago

@pepper you are right. I double-checked everythying, I was passing Project ID instead of Environment ID 🤦‍♂️


Project scoped if you’re still wondering.


Loading...