R
Railway•6mo ago
Chop

Creating service with railway api doesn't deploy properly anymore

Hello, when we create a new service using the railway api the "services" gets created but no deploys are made and a vague error is returned from the api. This was working before, a few weeks ago. We've changed nothing. Is there something we are doing incorrectly?
mutation {
serviceCreate(
input: {projectId: "", source: {image: "zjxde/ngnix-test"}}
) {
id
project {
environments {
edges {
node {
id
}
}
}
}
}
}
mutation {
serviceCreate(
input: {projectId: "", source: {image: "zjxde/ngnix-test"}}
) {
id
project {
environments {
edges {
node {
id
}
}
}
}
}
}
Error:
{
"errors": [
{
"message": "Problem processing request"
}
],
"data": null
}
{
"errors": [
{
"message": "Problem processing request"
}
],
"data": null
}
Solution:
turn out the serviceCreate mutation with a source will kick off a deployment, i was thinking of a different usecase, so apologies there. this works ```graphql mutation serviceCreate($input: ServiceCreateInput!) { serviceCreate(input: $input) {...
Jump to solution
16 Replies
Percy
Percy•6mo ago
Project ID: 001efb46-b92f-4a5f-935d-49a81a52755e
Chop
Chop•6mo ago
001efb46-b92f-4a5f-935d-49a81a52755e
Brody
Brody•6mo ago
create the service with serviceCreate but without a source, then call serviceConnect with a source, this will then kick off a deployment. and please use variables instead of hard coding them into the query itself
Chop
Chop•6mo ago
is there any way we can do this in one call?
Brody
Brody•6mo ago
not that i know of
Chop
Chop•6mo ago
It was working with one call before. Did you guys intentionally disable that?
Brody
Brody•6mo ago
i dont work for railway, so i couldnt say but when did it stop working?
Chop
Chop•6mo ago
We just noticed today
Brody
Brody•6mo ago
well the entire team has been on vacation for a while now, so there is zero chance an api change was made
Chop
Chop•6mo ago
It seems like serviceConnect needs a Id to know what to deploy... Sadly since serviceCreate is errorring its not returning any ids 😦 is it a different id maybe?
Brody
Brody•6mo ago
first get serviceCreate to stop erroring, then you will gen an id returned
Solution
Brody
Brody•6mo ago
turn out the serviceCreate mutation with a source will kick off a deployment, i was thinking of a different usecase, so apologies there. this works
mutation serviceCreate($input: ServiceCreateInput!) {
serviceCreate(input: $input) {
id
}
}
mutation serviceCreate($input: ServiceCreateInput!) {
serviceCreate(input: $input) {
id
}
}
{
"input": {
"name": "Ubuntu",
"projectId": "<project-id>",
"variables": { "foo": "bar", "baz": "qux" },
"source": {
"image": "ubuntu"
}
}
}
{
"input": {
"name": "Ubuntu",
"projectId": "<project-id>",
"variables": { "foo": "bar", "baz": "qux" },
"source": {
"image": "ubuntu"
}
}
}
like i said, please use variables, never hard code them into the query/mutation
Chop
Chop•6mo ago
gotcha thanks for clarifying... I've updated the code to use variables and its having the same error :/
Brody
Brody•6mo ago
show the code please, i have confirmed that muation works just fine on my end
Chop
Chop•6mo ago
oh wait I had a extra { That fixed it. Thanks!
Brody
Brody•6mo ago
no problem!