rkoval / alfred-aws-console-services-workflow

A powerful workflow for quickly opening up AWS Console Services in your browser or searching for entities within them.
MIT License
312 stars 54 forks source link

SharedConfigLoadError #33

Closed Nizari closed 3 years ago

Nizari commented 3 years ago

Dear Ryan,

Thank you for this plugin. This is amazing to use! I just had a strange error. One thing i did was saving the config file. Even though that the config file is in the correct format (because from the CLI I can still run commands) I get the below error. Do you know how to resolve this?

image

[16:45:47.033] Logging Started...
[16:45:50.673] AWS Console Services[Script Filter] Queuing argument ''
[16:45:50.763] AWS Console Services[Script Filter] Script with argv '(null)' finished
[16:45:50.765] ERROR: AWS Console Services[Script Filter] Code 1: 🍺
16:45:50 workflow.go:327: ---- AWS Console Services/3.6.0 (AwGo/0.20.2) ----
16:45:50 main.go:31: running workflow with query: ``
16:45:50 workflow.go:342: ------------------ FATAL ERROR -------------------
16:45:50 workflow.go:343: SharedConfigLoadError: failed to load config file, /Users/daanhage/.aws/credentials
caused by: INIParseError: invalid state with ASTKind { {4 NONE 0 [61]} true [{expr {1 STRING 0 [99 108 105 95 112 97 103 101 114]} true []}]} and TokenType none : goroutine 1 [running]:
runtime/debug.Stack(0xc0001c7c28, 0x1, 0x1)
    /usr/local/Cellar/go/1.14.5/libexec/src/runtime/debug/stack.go:24 +0x9d
github.com/deanishe/awgo.(*Workflow).Run.func2(0xc0000cf0e0)
    /Users/ryankoval/go/pkg/mod/github.com/deanishe/awgo@v0.25.0/workflow.go:343 +0xe7
panic(0x152d6e0, 0xc0000a9c60)
    /usr/local/Cellar/go/1.14.5/libexec/src/runtime/panic.go:969 +0x166
github.com/aws/aws-sdk-go/aws/session.Must(...)
    /Users/ryankoval/go/pkg/mod/github.com/aws/aws-sdk-go@v1.34.10/aws/session/session.go:326
github.com/rkoval/alfred-aws-console-services-workflow/awsworkflow.NewWorkflowSession(0x0, 0x0, 0xc0001c7e98)
    /Users/ryankoval/go/src/github.com/rkoval/alfred-aws-console-services-workflow/awsworkflow/aws.go:11 +0xef
main.main.func1()
    /Users/ryankoval/go/src/github.com/rkoval/alfred-aws-console-services-workflow/main.go:32 +0x9c
github.com/deanishe/awgo.(*Workflow).Run(0xc0000cf0e0, 0x15961e0)
    /Users/ryankoval/go/pkg/mod/github.com/deanishe/awgo@v0.25.0/workflow.go:357 +0x28f
main.main()
    /Users/ryankoval/go/src/github.com/rkoval/alfred-aws-console-services-workflow/main.go:30 +0x39
16:45:50 workflow.go:344: ---------------- END STACK TRACE -----------------
16:45:50 feedback.go:468: Sent 1 result(s) to Alfred
16:45:50 workflow.go:375: [ERROR] SharedConfigLoadError: failed to load config file, /Users/daanhage/.aws/credentials
caused by: INIParseError: invalid state with ASTKind { {4 NONE 0 [61]} true [{expr {1 STRING 0 [99 108 105 95 112 97 103 101 114]} true []}]} and TokenType none
16:45:50 workflow.go:401: ------------------- 5.139765ms -------------------
[16:45:50.793] AWS Console Services[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "L0IRDFFUKBAXMVQ07S4J48ON"
  },
  "items": [
    {
      "title": "SharedConfigLoadError: failed to load config file, /Users/daanhage/.aws/credentials\ncaused by: INIParseError: invalid state with ASTKind { {4 NONE 0 [61]} true [{expr {1 STRING 0 [99 108 105 95 112 97 103 101 114]} true []}]} and TokenType none",
      "valid": false,
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      }
    }
  ]
}
[16:47:38.261] AWS Console Services[Script Filter] Queuing argument ''
[16:47:38.346] AWS Console Services[Script Filter] Script with argv '(null)' finished
Nizari commented 3 years ago

Dear Ryan (and other who might face this issue). Very strange.... but this syntax broke. However not always:

[default]
aws_access_key_id = xxxxx
aws_secret_access_key = xxxx
cli_pager= # this cli_pager param...however now I cannot reproduce anymore as well. Quite strange...

The solution:

Hope this helps others a little.