sst / ion

SST v3
https://sst.dev
MIT License
1.45k stars 189 forks source link

SecretMissingError persists even though there is no Secret configured #673

Open TheHolyWaffle opened 1 month ago

TheHolyWaffle commented 1 month ago

I was experimenting with using new sst.Secret('GitlabClientSecret');

after adding this line to sst.config.ts I've executed sst dev. Doing so shows an failure:

❯ sst dev
SST ❍ ion 0.0.506  ready!

➜  App:        gitlab-watcher-ion
   Stage:      bertdegeyter
   Console:    https://console.sst.dev/local/gitlab-watcher-ion/bertdegeyter

×  Failed
   SecretMissingError: Set a value for GitlabClientSecret with `sst secret set GitlabClientSecret <value>`             
       at new Secret (file:///Users/bert.degeyter/dev/gitlab-watcher-ion/.sst/platform/src/components/secret.ts:102:13)
       at run (file:///Users/bert.degeyter/dev/gitlab-watcher-ion/sst.config.ts:18:20)                                 
       at run (file:///Users/bert.degeyter/dev/gitlab-watcher-ion/.sst/platform/src/auto/run.ts:36:26)                 
       at file:///Users/bert.degeyter/dev/gitlab-watcher-ion/eval.ts:6:28                                              
       at ModuleJob.run (node:internal/modules/esm/module_job:222:25)                                                  
       at ModuleLoader.import (node:internal/modules/esm/loader:316:24) {                                              
     secretName: 'GitlabClientSecret'                                                                                  
   }

However, when running the command sst secret set GitlabClientSecret foo and then repeating the sst dev command continues throwing the failure even though an Secret is set.

What's worse is that after removing new sst.Secret('GitlabClientSecret'); from sst.config.ts the SecretMissingError still persists!

I've tried deleting the sst-state folders in the S3 buckets, running sst remove, sst refresh, clearing .sst folder, clearing node_modules but nothing help. It keeps throwing the SecretMissingError in sst dev even though there is no Secret defined in sst.config.ts.

eschaefer commented 1 month ago

Current version 0.1.17

I just encountered a similar issue.

  1. Set all my secrets from my local machine with sst secret set TempAuthToken value --stage=prod.
  2. Let my CI deploy the app for the first time, and the error is


SST ❍ ion   ready!
➜  App:        bts
   Stage:      prod
~  Deploy
|  Error       
|  SecretMissingError: Set a value for TempAuthToken with `sst secret set TempAuthToken <value>`
|      at new Secret (file:///builds/publishing/xyz/.sst/platform/src/components/secret.ts:102:13)
|      at Object.bts_default (file:///builds/publishing/xyz/infra/bts.ts:24:5)
|      at run (file:///builds/publishing/xyz/sst.config.ts:33:37)
|      at run (file:///builds/publishing/xyz/.sst/platform/src/auto/run.ts:33:20)
|      at file:///builds/publishing/xyz/eval.ts:6:22 {
|    secretName: 'TempAuthToken'
|  }
✕  Failed    
   SecretMissingError: Set a value for TempAuthToken with `sst secret set TempAuthToken <value>`  
       at new Secret (file:///builds/publishing/xyz/.sst/platform/src/components/secret.ts:102:13)
       at Object.bts_default (file:///builds/publishing/xyz/infra/bts.ts:24:5)                    
       at run (file:///builds/publishing/xyz/sst.config.ts:33:37)                                 
       at run (file:///builds/publishing/xyz.sst/platform/src/auto/run.ts:33:20)                 
       at file:///builds/publishing/bts/eval.ts:6:22 {                                            
     secretName: 'TempAuthToken'                                                                  
   }                                                                                              
 ELIFECYCLE  Command failed with exit code 1.
 
 ```
 
 When I run `sst secret list --stage=prod` locally, all the secrets are there.
eschaefer commented 1 month ago

Update: turns out I had the wrong AWS_PROFILE set locally. Sometimes I switch these for different projects. Might want to double-check that.