2 months 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"
}
]12 Replies
2 months ago
https://railway.com/graphiql
I don't think serviceConfiguration is a valid query?
2 months ago
What are you trying to do?
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
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.
2 months ago
nvm i see it now
2 months ago
@codan84 What headers are you using to authenticate with the API using a project token?
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
....2 months ago
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…
2 months ago
I'd probably make sure your environment and service IDs are correct.
@pepper you are right. I double-checked everythying, I was passing Project ID instead of Environment ID 🤦♂️
2 months ago
Project scoped if you’re still wondering.