Secrets not working?

Problem description:

I have a secret, and I can see it in the Secret tab
When I try and read it with System.getenv("secret name"); however, that returns null.

Expected behavior:

I expect the value from System.getenv() to work.

Actual behavior:

It returns null.

Steps to reproduce:

System.out.printf("Here is your bitDB %s\n", System.getenv("bitDB")); // returns null
Connection c = null;
String bitApiKey = System.getenv("API_Key");
String bitDB = System.getenv("bitDB");
String bitUser = "----------";
String bitHost = "";
String bitPort = "5432";

Bug appears at this link:

It’s part of Teams for Teachers, but I’m assuming that replit engineers can see it.


I have this issue as well


Did you click the “save” button? Try restarting your repl too.

1 Like

Yeah, nothing seemed to work. I even tried explicitly defining the env variable like “EnV_VAR yanr dev” but it didn’t work. I think it added to the env variable of the system but not the running app


Also, one of my reply just didn’t have the secrets extension and I couldn’t install it. I fixed it by just using another repl template


SECRETS is a built-in Replit feature. You shouldn’t need an extension to use it. Static HTML/CSS/JS templates don’t have it though.


You still need to access it like any other extension and in one of my repls it’s not available for some reason.


What template is the Repl? You can’t use it with every template.


It seems like after some rather lengthy amount of time – minutes? hours? – the secrets do start to work.

I feel like the Java and JavaFX replits are just abandoned. There’s never any support here from replit engineers, it’s really frustrating.

I’ve liked using replit for my class this semester, it has some real advantages – but I don’t think I’ll be using it in the future for a Java-based class, it’s just not worth the heartache.

1 Like

2 posts were split to a new topic: Secrets not working in nextjs

Hi @mprogers sorry to hear this. I use Java repls with my classes too and secrets haven’t caused a headache yet. However maybe there is a reason for this and I’ve just been fortunate so far.

I’ve passed on this topic to support so they can respond. Sorry to ask but if there are any other outstanding Java issues that you’ve previously posted about could you link them in this topic?


Thanks for your concerns.

As I noted, after some lengthy period of time the secrets do start to work.

I’ve already filed bug reports on a few other problems (just search on my name). A few that come to mind are … the autoformat/indent button not always showing up, no JavaDoc auto-generation, (not really a bug), the inability to debug in JavaFX, and autocompletion just not working some of the time.

I also made several feature requests - the ability to modify a Teams for Education project once its been published and have those changes pushed to my students; the ability to integrate GitHub Copilot (which is free for teachers, as opposed to Replit’s $olution); the ability to color the currently executing line so I can see it when debugging.

Anyways, these are already in the system, I’ll just wait for them to be addressed. [Tbh, I was really hoping that would announce VSC integration during their Developer Day announcements, but I don’t think that happened …]

secrets arent working for me in python.

Hey @mprogers!

Secrets should be accessible to the program as soon as they are saved. The only caveat is the shell, which you will need to close and reopen in order for the environment variables to be accessible.


Can you send me the link to your Repl and elaborate on how secrets aren’t working as expected?


If anyone does not sign in as me, the program can’t find the secret.

People who run your repl from the cover page or fork your repl can’t access its secrets. If the repl has a website and they access the website, they can then, but not otherwise.

but what if I do not want to have a website?

Then they can’t access the secrets at all.

but because of that while I love replit, I had to use other online compiler