Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: Chrome
- Local OS: macOS
- Remote OS: Ubuntu
- Remote Architecture: amd64
code-server --version
: 4.16.1
Steps to Reproduce
- Install the attached extension (rename .zip to .vsix)
- Execute the hello world command. This will prompt for a value that will be stored using the
context.secrets
instance for this extension. Input any value and proceed. - Reload the browser tab
- Execute the hello world command again so that this time, we read the value and display it.
- Instead of showing the value, you will be prompted again for a value to store.
secrets-0.0.1.zip
NOTE: If you prefer, you can just create an extension with the following code:
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
// this method is called when your extension is activated
// your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {
// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "secrets" is now active!');
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
let disposable = vscode.commands.registerCommand('secrets.helloWorld', async () => {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
const value= await context.secrets.get('secrets.pass');
if(value){
vscode.window.showInformationMessage(`Retrieved ${value}`);
}else{
const value=await vscode.window.showInputBox({ title: 'Input secret value'});
if(value){
context.secrets.store('secrets.pass',value);
}
}
});
context.subscriptions.push(disposable);
}
// this method is called when your extension is deactivated
export function deactivate() {}
Expected
After the reload and executing the command a second time, the persisted value should be displayed.
According to the API, the secrets should be automatically persisted. But every time the browser tab reloads, the value is not there
/**
* A storage utility for secrets. Secrets are persisted across reloads and are independent of the
* current opened {@link workspace.workspaceFolders workspace}.
*/
readonly secrets: SecretStorage;
Actual
Values are not stored between sessions/reloads
I tried the same extension in codespaces and it worked as expected
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
- I cannot reproduce this in VS Code.
- I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- I am using HTTPS.
Notes
No response