Error on environmentCreate GraphQL Mutation
spread-admin
HOBBYOP

2 years ago

Hi,
I have a Github Action that deploys PRs to Railway. It's based on https://github.com/Faolain/railway-pr-deploy with some changes that I made.
It has been working great up until the last week or so, it appears as if something changed with the API, and ever since I'm getting the following error:

{
  "response": {
    "errors": [
      {
        "message": "Cannot create trigger for repo user does not have access to",
        "locations": [{ "line": 3, "column": 9 }],
        "path": ["environmentCreate"],
        "extensions": { "code": "INTERNAL_SERVER_ERROR" },
        "traceId": "5441697194652517304"
      }
    ],
    "data": null,
    "status": 200,
    "headers": {}
  },
  "request": {
    "query": "\n      mutation environmentCreate($input: EnvironmentCreateInput!) {\n        environmentCreate(input: $input) {\n          id\n          name\n          createdAt\n          deploymentTriggers {\n            edges {\n              node {\n                id\n                environmentId\n                branch\n                projectId\n              }\n            }\n          }\n          serviceInstances {\n            edges {\n              node {\n                id\n                domains {\n                  serviceDomains {\n                    domain\n                    id\n                  }\n                }\n                serviceId\n              }\n            }\n          }\n        }\n      }\n    ",
    "variables": {
      "input": {
        "name": "***",
        "projectId": "***",
        "sourceEnvironmentId": "***"
      }
    }
  }
}

If it matters, I'm using a global token (ie from my account settings, not a project settings).

Would appreciate any help with this!

42 Replies

spread-admin
HOBBYOP

2 years ago

b880d42a-b80e-4f1e-b8f1-75cdd868eef0


spread-admin
HOBBYOP

2 years ago

Hi team, is there any preferred method to ask these kind of questions?


brody
EMPLOYEE

2 years ago

Cannot create trigger for repo user does not have access to

are you sure you have access to the source repo of the service?


spread-admin
HOBBYOP

2 years ago

Hey Brody, thank you for your reply. Honestly I'm a little confused about who's the "user" in this case, that's supposed to have access.
The GraphQL API request is initiated by Github Actions through a workflow that has access to the repo. The GraphQL API request is using a Railway token so I don't think that has anything to do with the "repo".


spread-admin
HOBBYOP

2 years ago

But perhaps the confusion is over what "repo" the error is referring to? Is it the github repo? some kind of docker repo? something else?


spread-admin
HOBBYOP

2 years ago

Also keep in mind this entire setup has worked as-is until sometime in the afternoon hours (EDT) on Aug 14th.


brody
EMPLOYEE

2 years ago

what env should i be looking at?


spread-admin
HOBBYOP

2 years ago

One sec let me find the right one


spread-admin
HOBBYOP

2 years ago

The last error I had was for pr-331


brody
EMPLOYEE

2 years ago

both of these services are deployed from a github repo


brody
EMPLOYEE

2 years ago

do you have access to that repo?


spread-admin
HOBBYOP

2 years ago

Yes I'm the owner of that repo


brody
EMPLOYEE

2 years ago

who's acccount token was used


spread-admin
HOBBYOP

2 years ago

I also see railway connected on the github menu

1274057944765300700


spread-admin
HOBBYOP

2 years ago

So the GraphQL API request was done using my personal railway auth token


spread-admin
HOBBYOP

2 years ago

And seems like the railway integration also retains access so on that front I guess we're okay?

1274058329165004800


brody
EMPLOYEE

2 years ago

does it have access to that specfic repo?


spread-admin
HOBBYOP

2 years ago

Yes


spread-admin
HOBBYOP

2 years ago

Double checked


spread-admin
HOBBYOP

2 years ago

I guess I can remove the integration, reinstall it and retry if you think that might help?


brody
EMPLOYEE

2 years ago

i'm not saying we deprecated anything, but that action does use unintended mutations, you would want to contact the author of that action and ask then to update it


spread-admin
HOBBYOP

2 years ago

I already forked it since he's unresponsive. I can make the necessary changes, what are the unintended mutations?


spread-admin
HOBBYOP

2 years ago

(also if thre's a more "official"/"stable" alternative for creating envs from github actions I'd definitely prefer to use that than rolling my own 😅 )


brody
EMPLOYEE

2 years ago

its not something railway supports at this time


brody
EMPLOYEE

2 years ago

but as for the correct mutations.

open your project, open the dev tools.

go through all the actions to create a pr env in the ui with all the needed variables and then just take all the network calls and code-ify them


spread-admin
HOBBYOP

2 years ago

Ok I can look into it. Do you believe that that's indeed the issue and not some other auth related issue though?


spread-admin
HOBBYOP

2 years ago

Also is this [https://railway.app/graphiql](https://railway.app/graphiql) interface is a recommended way to explore the API? I'm also getting auth errors there


brody
EMPLOYEE

2 years ago

if you can't do it via the dashboard then its an auth issue, if you can do it via the dashboard then its an issue with that action


spread-admin
HOBBYOP

2 years ago

yeah the ui dashboard does work


spread-admin
HOBBYOP

2 years ago

Btw I notice I'm also getting the same error with another mutation:

{
  "response": {
    "errors": [
      {
        "message": "Cannot create trigger for repo user does not have access to",
        "locations": [{ "line": 6, "column": 9 }],
        "path": ["serviceInstanceRedeploy"],
        "extensions": { "code": "INTERNAL_SERVER_ERROR" },
        "traceId": "7925376593999893950"
      }
    ],
    "data": null,
    "status": 200,
    "headers": {}
  },
  "request": {
    "query": "\n      mutation serviceInstanceRedeploy(\n        $environmentId: String!\n        $serviceId: String!\n      ) {\n        serviceInstanceRedeploy(\n          environmentId: $environmentId\n          serviceId: $serviceId\n        )\n      }\n    ",
    "variables": {
      "environmentId": "***",
      "serviceId": "***"
    }
  }
}

spread-admin
HOBBYOP

2 years ago

Well actually I'm not sure the dashboard is the same action. I think the dashboard is redeploying an existing deployment, while the action tries to deploy a new version from github


brody
EMPLOYEE

2 years ago

you would want to be using all the same mutations the dashboard uses


spread-admin
HOBBYOP

2 years ago

I understand. First of all I appreciate you taking the time and helping Brody.
Otherwise, please understand the frustration and friction that comes when things that work one day, just break the next and I have to rush a hotfix that I had not planned. I'm somewhat concerned now that the mutations that the dashboard uses now might break in the future, if they do I think API users would appreciate a heads up.
Please take this as a constructive feedback to the team, I really like the Railway product otherwise.


brody
EMPLOYEE

2 years ago

i do understand the frustration but please keep in mind that what you where using was created by a community member with the knowledge that the mutations where already outdated and me and another railway employee has suggested them to update it and they refused.


spread-admin
HOBBYOP

2 years ago

Yeah, I understand. I wish that person was more responsive, I had tried to contact them mayn times for improvements and ended up just forking it myself.


brody
EMPLOYEE

2 years ago

i feel you, i wish they where too


spread-admin
HOBBYOP

2 years ago

For my own understanding, is there a good place to stay up to date with deprecation/things getting outtdated?


brody
EMPLOYEE

2 years ago

im sorry but railway moves too fast to keep that kind of information posted


spread-admin
HOBBYOP

a year ago

Hi Brody, I went through the actions in the dashboard, redeploying an existing environment works but creating a new environment gives me the same error I saw in the mutation above:

Failed to commit changes
Cannot create trigger for repo user does not have access to

I tried uninstalling and re-installing the Railway app from Github and I think there's an issue since I cannot see my target repo when I tried to connect it


spread-admin
HOBBYOP

a year ago

So I went through the actions in the dashboard, redeploying an existing environment works but creating a new environment gives me the same error I saw in the mutation above:

Failed to commit changes
Cannot create trigger for repo user does not have access to

I ended up re-installing the Github App and that seems to have resolved the issue.
Is this something thats expected to be needed every so often?


brody
EMPLOYEE

a year ago

that's very strange, haven't heard of needing to reinstall it for the sake of it, only when the user changes something and needs to re-auth


ryanlieu
PRO

8 months ago

Following up on this – I had the same exact issue and installing and reinstalling the github app fixed the issue. I was getting the error through railway's dashboard as well, so it's clearly not just an issue with the action/API. What's the solution here where it won't happen again?


Loading...