cli icon indicating copy to clipboard operation
cli copied to clipboard

Creating env from Windows causes errors.

Open MichealReed opened this issue 2 years ago • 8 comments

Bug report

  • [x ] I confirm this is a bug with Supabase, not with my own application.
  • [x ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Supabase CLI 1.50.11 on Windows 11

.env file

TEST="TEST"

command

supabase secrets set --env-file ./supabase/.env --debug

ouputs

Error: unexpected character "\x00" in variable name near "\xff\xfeT\x00E\x00S\x00T\x00=\x00\"\x00T\x00E\x00S\x00T\x00\"\x00"

When I create my env files from WSL, the extra null characters are not attached. I tried changing between CRLF/LF but found that the only remedy was to recreate the files via wsl. There is likely some sanitation of the files that can be done before parsing to ensure compatibility across hosts.

MichealReed avatar Apr 23 '23 21:04 MichealReed

Can you check the file encoding of your .env file? If you create a file in WSL vs. Windows, do they have different encodings/file endings?

soedirgo avatar May 09 '23 07:05 soedirgo

Changing the line endings didn't seem to do much. Probably could be caught by a generalized null character stripper during your serialization process. Seems Windows creates the files with additional null characters but not linux.

MichealReed avatar May 09 '23 17:05 MichealReed

File encodings orthogonal to line endings. You should be able to check for these like so - not able to do it myself since I don't have a Windows box

soedirgo avatar May 10 '23 06:05 soedirgo

Both are created UTF8 encoded, only visible difference in the newly created file is the line endings. CRLF (Windows), LF (Linux). Changing the windows generated file to LF does not seem to effect the CLI bug.

MichealReed avatar May 10 '23 08:05 MichealReed

I got same problem. Did you solve that ?

yigithancolak avatar Jun 18 '23 13:06 yigithancolak

I ran into this issue when I piped the output of status to the .env file using the following command. npx supabase status -o env > .env I had to clear my .env file and just recreate it. I assume it was some special character but when toggling render whitespace in vscode I didn't see anything, however the application did put it out to have CRLF as my line feeds.

SQLJames avatar Jul 05 '23 13:07 SQLJames

I am using Windows also and supabase cli made me crazy. It even not let me to write my database password to terminal tried every way possible for just taking the types file. Finally i found solution on linking my database without entering a password and i still don't know how it let me do that.

yigithancolak avatar Jul 05 '23 21:07 yigithancolak

I faced the same issue in .env.local file. Just delete and create the file again. It works for me.

hirenrafaliya avatar Nov 01 '23 19:11 hirenrafaliya