Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] CLI external-auth select-auth fails with an internal_error #270

Open
arnaubt opened this issue Jan 29, 2024 · 7 comments
Open

[BUG] CLI external-auth select-auth fails with an internal_error #270

arnaubt opened this issue Jan 29, 2024 · 7 comments

Comments

@arnaubt
Copy link

arnaubt commented Jan 29, 2024

The deno-slack versions

"deno-slack-hub/": "https://deno.land/x/deno_slack_hub@0.1.1/",
"deno-slack-sdk/": "https://deno.land/x/deno_slack_sdk@2.5.0/",
"deno-slack-api/": "https://deno.land/x/deno_slack_api@2.1.2/",

Deno runtime version

deno 1.39.1 (release, aarch64-apple-darwin)
v8 12.0.267.8
typescript 5.3.3

OS info

ProductName:		macOS
ProductVersion:		14.2.1
BuildVersion:		23C71
Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020

Describe the bug

slack external-auth select-auth fails with internal_error when trying to add OAuth to an existing workflow. The workflow in question has a new step using a Google Sheets connector function. Running the command initially seems to work, although it doesn't detect the new workflow. But after trying a couple of times, it fails with the internal error.
I have already reached out to Slack support and they redirected me here.

❯ slack external-auth select-auth

...

🚫 An internal error has occurred with the Slack platform (internal_error)

Suggestion:

Please reach out to feedback@slack.com if the problem persists.

The above errors were returned by the following Slack API method: /api/apps.auth.external.list
Full debug logs:
DEBUG 2024/01/29 11:19:10.241354 Resolving logstash host, https://slack.com, 2.17.0
DEBUG 2024/01/29 11:19:10.243533 system_id: 64e70a4b-883a-4856-b058-9ffbe4db0176
DEBUG 2024/01/29 11:19:10.244084 project_id: 8375b985-6909-466d-bb77-6e6cf8ce3d33
DEBUG 2024/01/29 11:19:10.244556 reading credentials file
DEBUG 2024/01/29 11:19:10.244883 found authorizations at .../.slack/credentials.json reading
DEBUG 2024/01/29 11:19:10.369445 initialized SDK CLI config: {Runtime:deno Hooks:{BuildProject:{Command:deno run -q --config=deno.jsonc --allow-read --allow-write --allow-net --allow-run --allow-env https://deno.land/x/deno_slack_hooks@1.2.3/build.ts Name:BuildProject} CheckUpdate:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.2.3/check_update.ts Name:CheckUpdate} GetHooks:{Command:deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.2.3/mod.ts Name:GetHooks} GetManifest:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/deno_slack_hooks@1.2.3/get_manifest.ts Name:GetManifest} GetTrigger:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/deno_slack_hooks@1.2.3/get_trigger.ts Name:GetTrigger} InstallUpdate:{Command:deno run -q --config=deno.jsonc --allow-run --allow-read --allow-write --allow-net https://deno.land/x/deno_slack_hooks@1.2.3/install_update.ts Name:InstallUpdate} Start:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net --allow-run --allow-env https://deno.land/x/deno_slack_runtime@1.1.1/local-run.ts  Name:Start}} Config:{Watch:{FilterRegex:\.(ts|js)$ Paths:[.]} SDKManagedConnection:false TriggerPaths:[] SupportedProtocols:[message-boundaries]} WorkingDirectory:}
DEBUG 2024/01/29 11:19:10.369819 initialize runtime from slack.json: Deno (deno)
INFO 2024/01/29 11:19:10.382438 ------------------------------------
INFO 2024/01/29 11:19:10.382687 Operating System (OS): [darwin]
INFO 2024/01/29 11:19:10.382697 Command: [slack external-auth select-auth]
INFO 2024/01/29 11:19:10.382704 SessionID: [69f9aa8c-fa4b-4196-bdc0-313407d1010e]
INFO 2024/01/29 11:19:10.382709 Slack-CLI-TraceID: [57b4cdd007342708]
INFO 2024/01/29 11:19:10.382713 Slack-CLI Version: [2.17.0]
INFO 2024/01/29 11:19:10.382716 System ID: [64e70a4b-883a-4856-b058-9ffbe4db0176]
INFO 2024/01/29 11:19:10.382719 Project ID: [8375b985-6909-466d-bb77-6e6cf8ce3d33]
DEBUG 2024/01/29 11:19:10.384853 reading credentials file
DEBUG 2024/01/29 11:19:10.385204 found authorizations at .../.slack/credentials.json reading
DEBUG 2024/01/29 11:19:10.387489 HTTP Request: POST https://slack.com/api/apps.status HTTP/1.1
HTTP Request Body:
{"app_ids":["<redacted>","<redacted>"],"team_id":"<redacted>"}
DEBUG 2024/01/29 11:19:10.697748 HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"apps":[{"app_id":"<redacted>","is_installed":true,"is_hosted":false},{"app_id":"<redacted>","is_installed":true,"is_hosted":true,"runtime_version":{"runtime":"deno","deployed_version":"1.37.0","latest_available_version":"1_39_4"}}],"team":{"team_id":"<redacted>","team_domain":"<redacted>","is_enterprise":false}}
DEBUG 2024/01/29 11:19:10.700943 GetAppStatus request for team <redacted> took: 313ms

DEBUG 2024/01/29 11:19:10.707701 reading credentials file
DEBUG 2024/01/29 11:19:10.709589 found authorizations at .../.slack/credentials.json reading
DEBUG 2024/01/29 11:19:10.711095 reading credentials file
DEBUG 2024/01/29 11:19:10.711889 found authorizations at .../.slack/credentials.json reading
DEBUG 2024/01/29 11:19:11.852871 Resolving logstash host, https://slack.com, 2.17.0
DEBUG 2024/01/29 11:19:11.856360 HTTP Request: POST https://slack.com/api/apps.auth.external.list HTTP/1.1
HTTP Request Body:
{"app_id":"<redacted>","include_workflows":true}
DEBUG 2024/01/29 11:19:12.510303 HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":false,"error":"internal_error"}
DEBUG 2024/01/29 11:19:12.512210 Starting root command cleanup routine
ERROR 2024/01/29 11:19:12.516932 An internal error has occurred with the Slack platform�[1;38;5;178m (internal_error)�[0m

Suggestion:

Please reach out to feedback@slack.com if the problem persists.

�[3m�[38;5;244mThe above errors were returned by the following Slack API method: /api/apps.auth.external.list�[0m�[0m

DEBUG 2024/01/29 11:19:12.523856 FlushToLogstash will POST https://slackb.com/events/cli payload: [{"context":{"bin":"slack","cli_version":"2.17.0","command":"external-auth select-auth","command_canonical":"external-auth select-auth","host":"b0c672ba8e0b24a3479fda1a5d59e53e823bc510","os":"darwin","project_id":"8375b985-6909-466d-bb77-6e6cf8ce3d33","runtime":"Deno","runtime_version":"v1.39.1","session_id":"69f9aa8c-fa4b-4196-bdc0-313407d1010e","system_id":"64e70a4b-883a-4856-b058-9ffbe4db0176"},"data":{"app":{},"auth":{},"error_msg":"An internal error has occurred with the Slack platform (internal_error)\n\nSuggestion:\n\nPlease reach out to feedback@slack.com if the problem persists.\n\nThe above errors were returned by the following Slack API method: /api/apps.auth.external.list\n"},"event":"error","timestamp":1706523552520}]
DEBUG 2024/01/29 11:19:12.648607 FlushToLogstash response status code: 200, body: ok

Steps to reproduce

  1. slack external-auth add-secret
  2. slack external-auth add
  3. slack external-auth select-auth (works correctly but doesn't detect the new workflow)
  4. slack external-auth select-auth (fails with the internal error)

Expected result

The workflow is detected and external auth is added for it.

Actual result

The workflow never gets detected and the CLI ends up failing with an internal error.

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

@filmaj
Copy link
Contributor

filmaj commented Jan 29, 2024

I cannot reproduce by running the reproduction steps on their own. This may be related to the specific context of this workflow, what it included before, and the new connector being added later.

One baseline question: as you are running the external auth commands yourself, I assume you want the spreadsheet connector to use your credentials, and not the end-user's credentials, is that right? just want to double check this.

Other than that, can you create a repro app that shows this failure? Something that can help me reproduce on my end? Without being able to reproduce on my end, it will be very difficult to debug and assist you.

@arnaubt
Copy link
Author

arnaubt commented Jan 31, 2024

Correct, I'm using my credentials and not the end-user's.

I've created a reproducing repo and PR: arnaubt/slack-external-auth-repro#1

Thanks!

@filmaj
Copy link
Contributor

filmaj commented Jan 31, 2024

Thank you! However, that repo is a 404 for me, perhaps private? You can add me as collaborator on it if you do not wish to publicize.

@arnaubt
Copy link
Author

arnaubt commented Feb 1, 2024

Sorry! Forgot to make it public, you should be able to access it now. Thanks again!

@dr-tomasz
Copy link

dr-tomasz commented Feb 16, 2024

Any news? I have the same case, the same error :/ @filmaj

@shashankmehra
Copy link

I am stuck at the same error as well. I was just following the documentation for external auth the first time.

@shashankmehra
Copy link

shashankmehra commented Mar 7, 2024

I tried to dig deeper into this by calling the API directly using my token. So when I call the following curl command:

curl -X POST "https://slack.com/api/apps.auth.external.list" \
  -H "Authorization: Bearer <redacted>" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"app_id": "<redacted>"}'

I am actually getting the correct output.

However the slack cli tool adds include_workflows param to the call. When this param is present I am getting the internal error response:

curl -X POST "https://slack.com/api/apps.auth.external.list" \
  -H "Authorization: Bearer <redacted>" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"app_id":"<redacted>","include_workflows":true}'

returns

{"ok":false,"error":"internal_error"}                                                                                                                                              

This seems to be server side issue when the parameter include_workflows is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants