Creating service using GraphQL API
I'm trying to create a service using the GraphQL API using the
serviceCreate
mutation, but have two problems
1. How do I send in variables? The doc comment in the GQL schema says "The ServiceVariables scalar type represents values as the TypeScript type: Record<string, string>. Example: "{ foo: 'bar', baz: 'qux' }". So I tried exactly that with this mutation:
and input
The service does get created, but the variables come in as:
2. My other issue, is that the service does not deploy after it is created. I found the mutation serviceInstanceRedeploy
but that only seems to work for services that have already deployed before.19 Replies
Project ID:
fe10b4ee-a87a-4f4d-9d88-355cef99b1e1
fe10b4ee-a87a-4f4d-9d88-355cef99b1e1
1. dont quote the
variables
object.
2. dont add the source to the serviceCreate
mutation, add the source to the service with serviceConnect
this will then trigger a deploy from the newly added source.i get back an error
nvm, I got it
It still doesn't initiate a deploy though
updated my info, check again
Ok thanks i'll give that a swing
I'm getting an error for 'not authrized' with connectService, using the same token i used to create the service
what kind of token are you using?
I created a team token on my account screen in the tokens section
is the service you are trying to do
serviceConnect
on in said team?Yes
send your
serviceConnect
mutation pleasewith the variables too please
scraper
🫤
are you aware that running a scraper on railway is generally against railway's tos?I was not, we will come up with a different solution then
ill still figure this out for you, just dont use it to deploy a scraper lol
Ok sounds good, thank you
best not to risk the ban
you are getting not authorized because that repo is tied to your personal account, thus you need to use a personal token when making that api request
railways dashboard uses the correct token automatically