peterhartree
peterhartree
RRailway
Created by peterhartree on 1/1/2024 in #✋|help
cURL request with valid GraphQL query fails with "Problem processing request"
The following GraphQL query works as expected for me:
read -r -d '' QUERY << EOF
{
"query": "query variables { variables(projectId: \"XXX\", environmentId: \"XXX\", serviceId: \"XXX\")}"
}
EOF

curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_TOKEN" --data "$QUERY" $RAILWAY_API_ENDPOINT
read -r -d '' QUERY << EOF
{
"query": "query variables { variables(projectId: \"XXX\", environmentId: \"XXX\", serviceId: \"XXX\")}"
}
EOF

curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_TOKEN" --data "$QUERY" $RAILWAY_API_ENDPOINT
However, the following deployments query returns: {"errors":[{"message":"Problem processing request"}]}.
read -r -d '' QUERY << EOF
{
"query": "query deployments { deployments(first: 1, input: { projectId: \"XXX\", environmentId: \"XXX\", serviceId: \"XXX\" }) { edges { node { id, staticUrl }}}"
}
EOF

curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_TOKEN" --data "$QUERY" $RAILWAY_API_ENDPOINT
read -r -d '' QUERY << EOF
{
"query": "query deployments { deployments(first: 1, input: { projectId: \"XXX\", environmentId: \"XXX\", serviceId: \"XXX\" }) { edges { node { id, staticUrl }}}"
}
EOF

curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_TOKEN" --data "$QUERY" $RAILWAY_API_ENDPOINT
The deployments query matches an example from the docs. When I run the deployments query in the Railway GraphQL playground, it works as expected. In all three cases I've triple checked that I'm using the same auth token and project/environment/service IDs. What could cause the issue with my deployments query? Thanks in advance. ❤️
11 replies