pscale branch create fails: branch does not exist in databse
I am trying to set up a workflow to create a test db branch to run e2e tests on. Here are the relevant lines of the workflow:
env:
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PSCALE_SERVICE_TOKEN }}
PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PSCALE_SERVICE_TOKEN_ID }}
steps:
- name: Setup PlanetScale CLI
uses: planetscale/setup-pscale-action@v1
- name: Create PlanetScale test branch
run: pscale branch create mydb test-branch --from dev --wait --org MyOrg
I get the folowwing error:
Error: branch test-branch does not exist in database *** (organization: ***)
Note: You are using a service token for authentication. If this resource exists, your service token may not have the required 'read_branch' permission to access it. Please check your service token permissions
If I copy the exact pscale branch create call locally and run it, it creates the branch without an issue.
I have set up the Service Token with full permissions to the database and even tried recreating it from scratch with no luck, so it does not appear to be a permissions issue unless planetscale is missing a permission option that is needed here... the "does not exist" error from the creation call is confusing since it is supposed to be creating the branch not accessing it.
Any idea of a fix / work around to this issue?
Hey @Cam-Bread, could you email me the service token ID and the name of the org? I can check more detailed logs on our side.
mike at planetscale dot com
Another idea to try pscale auth check. Just to be sure the token is able to authenticate at all.
I figured out the issue...I capatalized the first letter of the org name when it was supposed to be all lower case haha.
Weirdly that does not effect things when I run it locally, only when run as a github action.
Looks like it may have actually been creating the branch the whole time but then erroring when it was doing a check to verify the branch was ready due to the org case sensitivity. hence why it was giving the strange error saying the branch i was creating doesnt exist.