Skip to content

Commit ad8bc1b

Browse files
authored
Descriptive error if org cannot be determined
* PlanetScale service tokens do not have any scope to list orgs of a user * if ORG_NAME is not explicitly set, only scopes obtained by pscale auth will allow automated org determination * write prescriptive error message to set ORG_NAME explicitly in cases where no Web SSO auth was done
1 parent b09593d commit ad8bc1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.pscale/cli-helper-scripts/set-db-and-org-and-branch-name.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ echo "Using DB name ${DB_NAME}"
66
# set org name to first org the user has access to unless it is already set in ORG_NAME
77
if [ -z "${ORG_NAME}" ]; then
88
export ORG_NAME=`pscale org list --format json | jq -r ".[0].name"`
9-
# check exit code
10-
if [ $? -ne 0 ]; then
11-
echo "Error: Failed to get PlanetScale org name"
9+
# check exit code and name of the org
10+
if [ $? -ne 0 ] || [ -z "${ORG_NAME}" ]; then
11+
echo "Error: Failed to get PlanetScale org name, please set ORG_NAME explicitly or use Web based SSO, service tokens do not allow to list orgs."
1212
exit 1
1313
fi
1414
fi

0 commit comments

Comments
 (0)