2 months ago
Currently using the gql api to try to fetch all of my projects on my hobby account, they're all under the same workspace, and I'm the only user. Its only returning two projects which happen to be older projects from over a year go (this is the only thing that i think is different about the projects), any new project I make doesn't show up in the response.
This is the query
query me{
me {
projects {
edges {
node { id name }
}
}
}
}Any help appreciated
2 Replies
I am using an account api key btw, so it should have access to all of the projects on that account
Okay update, attempted using a workspace token to authenticate and this query gave me all of my projects
query ListProjects_root($first: Int!) {
projects(first: $first) {
edges {
node { id name }
}
}
}my current guess, is that my account is old, at least 2-3 years old and i think its gone through some over time updates to data schemas etc, my thought is that the two projects that are returning (the older ones) are linked directly to my account but the new ones are not? I also just tested creating a new account and adding a project and am seeing the exact same behavior, the account token with the me -> projects query is returning nothing but with the workspace token, the projects only query is showing the projects, is this expected behavior? if so the docs with the me query api example should be changed
continuing the experimentation
the projects query that i showed without the me, does show all of the projects when i use the workspace token, but shows no projects when i use the account token
2 months ago
Use your workspace token (not the account token) with your second query - that's the right way to get all your projects. Your older projects (from a year ago) are linked the "old way" directly to your account, but newer projects are linked through workspaces. The account token + me.projects only sees the old ones, while the workspace token sees everything.
2 months ago
Okay thank you, that's the conclusion I came to as well
https://docs.railway.com/guides/manage-projects
This page specifically should probably be changed, I'll make a PR to get that updated
Status changed to Solved brody • about 2 months ago
