admin管理员组文章数量:1244331
I've installed Supabase locally on my dev machine (and plan to deploy it to a non-Supabase host). So far, everything with Supabase itself has worked great (e.g. I can navigate to http://127.0.0.1:54323/ to see the "Studio").
However, whenever I try to generate types for my client, I get a confusing error:
$ npx supabase gen types typescript
Access token not provided. Supply an access token by running supabase login or setting the SUPABASE_ACCESS_TOKEN environment variable.
I don't have an access token, and since I'm self-hosted I can't get one. I don't understand why I'd even need one just to generate types (that has nothing to do with my choice of hosts).
Does anyone know how I can generate types locally?
I thought perhaps the environmental variables from my .env.local
weren't being accessed, so I tried adding them at the command line:
$ SUPABASE_URL=http://127.0.0.1:54321 SUPABASE_KEY=1234_MY_SECRET_KEY_5678 npx supabase gen types typescript
However, I still got the same error.
I've installed Supabase locally on my dev machine (and plan to deploy it to a non-Supabase host). So far, everything with Supabase itself has worked great (e.g. I can navigate to http://127.0.0.1:54323/ to see the "Studio").
However, whenever I try to generate types for my client, I get a confusing error:
$ npx supabase gen types typescript
Access token not provided. Supply an access token by running supabase login or setting the SUPABASE_ACCESS_TOKEN environment variable.
I don't have an access token, and since I'm self-hosted I can't get one. I don't understand why I'd even need one just to generate types (that has nothing to do with my choice of hosts).
Does anyone know how I can generate types locally?
I thought perhaps the environmental variables from my .env.local
weren't being accessed, so I tried adding them at the command line:
$ SUPABASE_URL=http://127.0.0.1:54321 SUPABASE_KEY=1234_MY_SECRET_KEY_5678 npx supabase gen types typescript
However, I still got the same error.
Share Improve this question edited 2 days ago machineghost asked Feb 17 at 19:05 machineghostmachineghost 35.8k32 gold badges173 silver badges259 bronze badges 1 |1 Answer
Reset to default 2If you have the CLi installed you can run with the --local
flag as indicated in the comment from first last
npx supabase gen types --local
But if you are self-hosting and want to generate it based on the hosted elsewhere, then you can also pass the DB-URL: --db-url
flag.
Note that you can also generate types for Swift and Typescript:
--lang <[ typescript | swift ]>
All details are available on the docs
本文标签: How do I generate types with Supabase locally (ie not hosted with Supabase)Stack Overflow
版权声明:本文标题:How do I generate types with Supabase locally (i.e. not hosted with Supabase)? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740132138a2229944.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
npx supabase gen types typescript --local > database.types.ts
– first last Commented Feb 18 at 8:58