Error using Doppler on Windows

Using Doppler CLI to inject environment variables using the command

doppler run --no-cache – next dev

The error I receive is

Unable to determine home directory
Doppler Error: %userprofile% is not defined

Running on Windows 11 - doppler login and setup is successful. I am also able to retrieve the secrets via doppler secrets.

Any help will be appreciated.

Hi @Hamza_V!

Welcome to the Doppler Community!

Could you post what you see when you run echo %USERPROFILE%? This should point to something like C:\Users\your-user-name. If nothing gets printed, can you confirm for me whether or not you’re using a shell session that was started with “Run as an Administrator”? If you did, could you try opening up a shell session as your user instead and then run echo %USERPROFILE% again?

Regards,
-Joel

Hey Joel,

Thanks for responding back! When I run echo %USERPROFILE% I do receive C:\Users\your-user-name

Thanks,

@Hamza_V Are you just running inside a command prompt or PowerShell? Or are you using something like WSL2? All we’re doing to get that is calling GoLang’s built-in os.UserHomeDir() function which returns the value of %USERPROFILE% as described here. If that’s failing, then it seems like the CLI command must be executing in a context where that value isn’t being set for some reason.

Regards,
-Joel

As a quick follow-up, could you try running echo %userprofile% as well? I wonder if there may be some kind of case-sensitivity issue and %USERPROFILE% is set, but not %userprofile%.

Running echo %userprofile% printed the same value as above. I ran the echo command in command prompt however I execute doppler run --no-cache – next dev in PowerShell. To confirm, running doppler run --no-cache – next dev in command prompt resulted in the same error.

Could you try running doppler run -- echo %userprofile%?

Edit: Actually, this obviously won’t work since it fails before it runs. Could you confirm for me what installation method you used for the CLI? Going to try reproducing this in a Windows 11 VM.

I used the same method as described in the docs - via winget. It was working before, but since yesterday it has been throwing me an error. In addition, I have another developer in my organization who is facing the same issue (also on Windows). However, running the doppler run --no-cache – next dev command in docker nodejs:20-slim container works fine.

winget install doppler.doppler

@Hamza_V Could you try running doppler configure reset and then do a fresh doppler login? You’ll need to run doppler setup again for any projects you had done that for previously after doing this, but this may help. I just tested via a Winget install and everything seems to be working fine on my end. Let me know if doing the reset helps!

Hey Joel,

That did not fix the issue. I might try a fresh install and will let you know of the results.

Thanks,

Update: Uninstalling and then reinstalling did not fix the issue

Hello,
Can you please explain more.

I faced this issue when using turborepo v2. For anyone else facing this issue:

  1. open turbo.json
  2. under your task (“dev”, “serve”, “start” etc.) add "env": ["USERPROFILE"] or better yet, add "globalEnv": ["USERPROFILE"]

This is to allow turbo to pass the env variables through the filter so that doppler is able to access.