msolecki
msolecki
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
really thanks @Brody
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
and now it works 😄
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
just "Authorization": Bearer ${railwayToken}, ?
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
still Not Authorized
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
personal token
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
try {
const serviceID = process.env.SITE_SERVICE_ID
const environmentID = process.env.SITE_ENVIRONMENT_ID

const gqlReq = async (options) => {
const req = await fetch(`https://backboard.railway.app/graphql/v2?q=${options.operationName}`, {
headers: {
"cache-control": "no-cache",
"content-type": "application/json",
},
method: "POST",
body: JSON.stringify({
operationName: options.operationName,
query: options.query,
variables: options.variables,
}),
mode: "cors",
credentials: "include",
})

if (req.status != 200) {
return [null, Error(`Non 200 status code returned from API: ${req.status}`)]
}


const res = await req.json()

if (res.errors != undefined) {
return [null, Error(res.errors[0].message)]
}


if (res.data == null) {
return [null, Error("The API returned the null data type")]
}


return [res.data[options.operationName], null]
}


const [serviceInstanceRedeploy, serviceInstanceRedeployError] = await gqlReq({
operationName: "serviceInstanceRedeploy",
query: `mutation serviceInstanceRedeploy($environmentId: String!, $serviceId: String!) {\n serviceInstanceRedeploy(environmentId: $environmentId, serviceId: $serviceId)\n}`,
variables: {
"environmentId": environmentID,
"serviceId": serviceID,
},
})

if (serviceInstanceRedeployError != null) {
console.error('Error hitting webhook', serviceInstanceRedeployError)
return
}

publishWebhookTimeout = null
} catch (err) {
// eslint-disable-next-line no-console
console.error('Error hitting webhook', err)
}
try {
const serviceID = process.env.SITE_SERVICE_ID
const environmentID = process.env.SITE_ENVIRONMENT_ID

const gqlReq = async (options) => {
const req = await fetch(`https://backboard.railway.app/graphql/v2?q=${options.operationName}`, {
headers: {
"cache-control": "no-cache",
"content-type": "application/json",
},
method: "POST",
body: JSON.stringify({
operationName: options.operationName,
query: options.query,
variables: options.variables,
}),
mode: "cors",
credentials: "include",
})

if (req.status != 200) {
return [null, Error(`Non 200 status code returned from API: ${req.status}`)]
}


const res = await req.json()

if (res.errors != undefined) {
return [null, Error(res.errors[0].message)]
}


if (res.data == null) {
return [null, Error("The API returned the null data type")]
}


return [res.data[options.operationName], null]
}


const [serviceInstanceRedeploy, serviceInstanceRedeployError] = await gqlReq({
operationName: "serviceInstanceRedeploy",
query: `mutation serviceInstanceRedeploy($environmentId: String!, $serviceId: String!) {\n serviceInstanceRedeploy(environmentId: $environmentId, serviceId: $serviceId)\n}`,
variables: {
"environmentId": environmentID,
"serviceId": serviceID,
},
})

if (serviceInstanceRedeployError != null) {
console.error('Error hitting webhook', serviceInstanceRedeployError)
return
}

publishWebhookTimeout = null
} catch (err) {
// eslint-disable-next-line no-console
console.error('Error hitting webhook', err)
}
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
any example? I am trying 2 different tokens (team and personal) and getting errors
23 replies
RRailway
Created by msolecki on 9/25/2023 in #✋|help
How to rebuild service from code?
f1ffdfca-0eb5-4966-b060-cd7eb7df4fed
23 replies
RRailway
Created by msolecki on 9/10/2023 in #✋|help
webhook to rebuild service
project ID - f1ffdfca-0eb5-4966-b060-cd7eb7df4fed
7 replies
RRailway
Created by msolecki on 7/24/2023 in #✋|help
paylaodcms + volume = not works
Thanks @Brody
14 replies
RRailway
Created by msolecki on 7/24/2023 in #✋|help
paylaodcms + volume = not works
staticDir = /home/node/app/media and disc mounting path = /home/node/app/media and now it works
14 replies
RRailway
Created by msolecki on 7/24/2023 in #✋|help
paylaodcms + volume = not works
Nope. That broke whole build
14 replies
RRailway
Created by msolecki on 7/24/2023 in #✋|help
paylaodcms + volume = not works
The same.
14 replies
RRailway
Created by msolecki on 7/24/2023 in #✋|help
paylaodcms + volume = not works
project id - 94994a5d-3273-456f-9fab-183aee28c449
14 replies