slackapi / deno-slack-sdk

SDK for building Run on Slack apps using Deno
https://api.slack.com/automation
MIT License
158 stars 27 forks source link

Error "Incorrect function" when executing `slack login` on Windows #221

Closed rknj closed 11 months ago

rknj commented 11 months ago

The deno-slack versions

N/A

Deno runtime version

1.37.0

OS info

Windows (amd64)

Describe the bug

Steps to reproduce

  1. Install Deno (choco install deno)
  2. Check versions (deno --version and slack doctor)
  3. Execute slack login to log into a workspace

Expected result

Get this output:

Run the following slash command in any Slack channel or DM
   This will open a modal with user permissions for you to approve
   Once approved, a challege code will be generated in Slack

/slackauthticket xxxxxxxxxxx

? Enter challenge code 

And then be able to set the generated code from Slack

Actual result

When running slack login, I get the following output:

Run the following slash command in any Slack channel or DM
   This will open a modal with user permissions for you to approve
   Once approved, a challege code will be generated in Slack

/slackauthticket xxxxxxxxxxx

? Enter challenge code Check C:\Users\xxx\.slack\logs\slack-debug-20230921.log for full error logs

Incorrect function.

While I should be able to set the challenge code.

Here are the logs:

DEBUG 2023/09/22 09:49:13 Resolving logstash host, https://slack.com, 2.9.0
DEBUG 2023/09/22 09:49:13 system_id: xxxxxxxxxx
DEBUG 2023/09/22 09:49:13 reading credentials file
DEBUG 2023/09/22 09:49:13 found authorizations at ...\.slack\credentials.json reading
DEBUG 2023/09/22 09:49:13 initialize runtime from auto-detect: Deno (deno)
INFO 2023/09/22 09:49:13 ------------------------------------
INFO 2023/09/22 09:49:13 System ID: [xxxxxxxxxx]
INFO 2023/09/22 09:49:13 Operating System (OS): [windows]
INFO 2023/09/22 09:49:13 Command: [C:\Program Files\SlackCLI\bin\slack.exe login]
INFO 2023/09/22 09:49:13 SessionID: xxxxxxxxxx
INFO 2023/09/22 09:49:13 Slack-CLI-TraceID: [xxxxxxxxxx]
INFO 2023/09/22 09:49:13 Slack-CLI Version: [2.9.0]
DEBUG 2023/09/22 09:49:13 HTTP Request: POST https://slack.com/api/apps.hosted.generateAuthTicket HTTP/1.1
HTTP Request Body:
slack_cli_version=v2.9
DEBUG 2023/09/22 09:49:13 HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"ticket":"xxxxxxxxxx"}
DEBUG 2023/09/22 09:49:13 Starting root command cleanup routine
ERROR 2023/09/22 09:49:13 Incorrect function.
DEBUG 2023/09/22 09:49:13 FlushToLogstash will POST https://slackb.com/events/cli payload: [{"context":{"bin":"C:\\Program Files\\SlackCLI\\bin\\slack.exe","cli_version":"2.9.0","command":"login","command_canonical":"auth login","host":"xxxxxxxxxx","os":"windows","runtime":"Deno","runtime_version":"v1.37.0","session_id":"xxxxxxxxxx","system_id":"xxxxxxxxxx"},"data":{"app":{},"auth":{},"error_msg":"Incorrect function."},"event":"error","timestamp":1695368953559}]
DEBUG 2023/09/22 09:49:13 FlushToLogstash response status code: 200, body: ok

And here's the output of slack doctor:

SYSTEM

    ✔ Operating System (the computer conductor)
        Version: windows (amd64)

    ✔ Deno (a JavaScript runtime)
        Version: v1.37.0
        Recommendation: We suggest using the latest version of Deno

    ✔ Git (a version control system)
        Version: git version 2.31.1.windows.1

SLACK

    ✔ CLI (this tool for building Slack apps)
        Version: 2.9.0

    ✔ Configurations (any adjustments to settings)
        System ID: xxx
        Last updated: 2023-09-21 13:51:42 +02:00
        Experiments: None

    ✘ Credentials (your Slack authentication)
      Error: You are not logged into a workspace or have not installed an app (slack_auth_error)
      Suggestion: Use the command `slack.exe login` to login and `slack.exe install` to install your app

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.

rknj commented 11 months ago

I forgot to add the logs. Description is now up-to-date

filmaj commented 11 months ago

@rknj so sorry for the lack of response here! My apologies.

Which version of Windows are you running?

srajiang commented 11 months ago

Hi @rknj - Is it possible you have some Windows permission setting preventing the CLI from accessing the disc to write to the filesystem which is required for the CLI to work properly? I'm unable to reproduce this behavior directly on my side. Some troubleshooting questions for you:

rknj commented 11 months ago

Thanks for your feedback! I followed the windows installation steps. And I just discovered that it's working well with the PowerShell. When I created this issue I was trying with MINGW64

filmaj commented 11 months ago

We've added a little callout to the Windows installation instructions on our Quickstart docs, calling out that the CLI only works on PowerShell at this time.

Going to close this issue but feel free to re-open if you have more questions or concerns.