devvit icon indicating copy to clipboard operation
devvit copied to clipboard

Devvit Secret shadows Devvit Setting even after being deleted.

Open isFakeAccount opened this issue 10 months ago • 0 comments

I encountered an issue with Devvit Setting / Secret Storage. When I was developing app I added a secret to my devvit app.

Devvit.addSettings([
    {
        name: "Gemini-API-Key",
        label: "Gemini API Key",
        type: "string",
        scope: "app",
        helpText: "Enter your Gemini API Key here",
        isSecret: true
    },
]);

Later I ended up changing my mind and made it per install app because I thought it would be better if ever user brought their own api instead of using mine.

Devvit.addSettings([
    {
        name: "Gemini-API-Key",
        label: "Gemini API Key",
        type: "string",
        scope: "installation",
        helpText: "Enter your Gemini API Key here",
    },
]);

But with this change when I grab the key using the

const apiKey = (await ctx.settings.get("Gemini-API-Key")) as string;

It still grabs the old secret that I set instead of the new value from app setting page. So even when I stopped using the secret, the secret still somehow exist in the Devvit system.

Devvit needs to automatically clear secrets if they are not being referred in the code and free up its namespace. Or at least provide a cmd in devvit cli to delete all secret storage for an app.

isFakeAccount avatar Feb 24 '25 00:02 isFakeAccount