supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.06k stars 207 forks source link

Output of anon_key and service_role key on `supabase start` is incorrect on Windows Terminal #92

Closed holtalanm closed 2 years ago

holtalanm commented 2 years ago

Bug report

Describe the bug

Ran supabase start and got the following output locally:

Started local development setup.
API URL: http://localhost:54321
DB URL: postgresql://postgres:postgres@localhost:54322/postgres
Studio URL: http://localhost:54323
anon key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiJ9.ZopqoUt20nEV9cklpv9e3yw3PVyZLmKs5
service_role key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIn0.M2d2z4SFn5C7Hl

But when I used the anon_key to send a request via Invoke-WebRequest in PowerShell:

curl 'http://localhost:54321/rest/v1/' -H @{
>> "apikey" = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiJ9.ZopqoUt20nEV9cklpv9e3yw3PVyZ
>> "Authorization" = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiJ9.ZopqoUt20nEV9cklpv9e3yw3PVyZLmKs5"
>> }
curl : {
  "message":"Invalid authentication credentials"
}
At line:1 char:1
+ curl 'http://localhost:54321/rest/v1/' -H @{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-
   WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWeb
   RequestCommand

Dug into the kong container and found the kong.yml where the credentials are stored:

consumers:
  - username: anon
    keyauth_credentials:
      - key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiJ9.ZopqoUt20nEV9cklpv9e3yw3PVyZLmKs5qLD6nGL1SI
  - username: service_role
    keyauth_credentials:
      - key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIn0.M2d2z4SFn5C7HlJlaSLfrzuYim9nbY_XI40uWFN3hEE

Turns out the output from supabase start was cut off. Could be considered a terminal issue, but I havent had this kind of issue with any othr CLI program, so figured I'd raise it here.

To Reproduce

I outlined it in the description.

Expected behavior

I expected to get an http status code 200 for my Invoke-WebRequest command.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 0.15.9 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

soedirgo commented 2 years ago

Should be fixed with the PR - do reopen if it isn't though 🙏