slack-samples / deno-starter-template

A template for building Slack apps with Deno
MIT License
101 stars 19 forks source link

sdk_hook_not_found when following Quick-Start #65

Open Equirinya opened 2 months ago

Equirinya commented 2 months ago

I've followed the Quick-Start https://api.slack.com/automation/quickstart and but no matter which template I'm cloning i always get this error: The start script was not found (sdk_hook_not_found).:

This is the slack doctor:

SYSTEM

    ✔ Operating System (hardware access mediator)
        Version: windows (amd64)

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

SLACK

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

    ✔ Configurations (any adjustments to settings)
        System ID: bee42360-9bdf-4b9a-8dab-e9125db24be5
        Last updated: 2024-05-05 10:32:46 +02:00
        Experiments: None

    ✔ Credentials (your Slack authentication)
        Team domain: filmstudio-sandbox
        Team ID: E071QTEKEPM
        User ID: U071N4057B7
        Last updated: 2024-05-05 09:57:53 +02:00
        Authorization level: Organization
        Token status: Valid

PROJECT

    ✔ Configurations (your project's CLI settings)
        Project ID: cd3390af-da66-4274-89c1-2c4aeb79d6f5

    ✘ Runtime (foundations for the application)
      Error: The `doctor` hook was not found (sdk_hook_not_found)
      Suggestion: Ensure this hook is implemented in your `slack.json`

    ✘ Dependencies (requisites for development)
      Error: The `check-update` hook was not found (sdk_hook_not_found)
      Suggestion: Ensure this hook is implemented in your `slack.json`

The slack.json file is present and looks like this:

{
  "hooks": {
    "get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.0/mod.ts"
  }
}

Im executing the slack run command in the right folder I've upgraded the slack cli to the latest version the slack.json file is identical to the one of this slack-sample

These are the logs:

PS C:\Users\peter\Desktop\Programming\Bots\my-app> slack run -v
[2024-05-05 11:05:55] Resolving logstash host, https://slack.com, 2.23.0
[2024-05-05 11:05:55] system_id: bee42360-9bdf-4b9a-8dab-e9125db24be5
[2024-05-05 11:05:55] project_id: cd3390af-da66-4274-89c1-2c4aeb79d6f5
[2024-05-05 11:05:55] active flag experiments: []
[2024-05-05 11:05:55] active project experiments: []
[2024-05-05 11:05:55] active system experiments: []
[2024-05-05 11:05:55] reading credentials file
[2024-05-05 11:05:55] found authorizations at C:\Users\peter\.slack\credentials.json reading
[2024-05-05 11:05:55] failed to initialize slack.json configurations: Command for 'GetHooks' returned an error: exec: "pwsh": executable file not found in %!P(MISSING)ATH%!
(MISSING) (sdk_hook_invocation_failed)

Suggestion:

Run `slack doctor` to check that your system dependencies are up-to-date.
[2024-05-05 11:05:55] initialize runtime from auto-detect: Deno (v1.43.1)
[2024-05-05 11:05:55] reading credentials file
[2024-05-05 11:05:55] found authorizations at C:\Users\peter\.slack\credentials.json reading
? Choose a local environment Install to a new team
? Install to a new team filmstudio-sandbox E071QTEKEPM

> If you leave this team, you can no longer manage the installed apps
   Installed apps will belong to the team if you leave the workspace

[2024-05-05 11:05:57] HTTP Request: POST https://slack.com/api/auth.test HTTP/1.1
HTTP Request Body:
token=...
[2024-05-05 11:05:57] HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"url":"https://filmstudio-sandbox.enterprise.slack.com/","team":"FIlmstudio Sandbox","user":"...","team_id":"E071QTEKEPM","user_id":"U071N4057B7","expires_in":39116,"enterprise_id":"E071QTEKEPM","is_enterprise_install":true}
[2024-05-05 11:05:57] reading credentials file
[2024-05-05 11:05:57] found authorizations at C:\Users\peter\.slack\credentials.json reading
[2024-05-05 11:05:57] Resolving logstash host, https://slack.com, 2.23.0
[2024-05-05 11:05:57] HTTP Request: POST https://slack.com/api/auth.teams.list HTTP/1.1
HTTP Request Body:
limit=100&token=...
[2024-05-05 11:05:58] HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"teams":[{"id":"T071QTF1WRH","name":"FIlmstudio Sandbox"}],"response_metadata":{"next_cursor":""}}
> Your app will be installed to the "filmstudio-sandbox" organization
   If you'd like, you can restrict access to only users in a particular workspace

? Choose a workspace to grant access: FIlmstudio Sandbox T071QTF1WRH
[2024-05-05 11:05:58] HTTP Request: POST https://slack.com/api/auth.test HTTP/1.1
HTTP Request Body:
token=...
[2024-05-05 11:05:58] HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"url":"https://filmstudio-sandbox.enterprise.slack.com/","team":"FIlmstudio Sandbox","user":"...","team_id":"E071QTEKEPM","user_id":"U071N4057B7","expires_in":39115,"enterprise_id":"E071QTEKEPM","is_enterprise_install":true}
[2024-05-05 11:05:58] Starting root command cleanup routine
Check C:\Users\peter\.slack\logs\slack-debug-20240505.log for full error logs

> The `start` script was not found (sdk_hook_not_found)

Suggestion:

Hook scripts are defined in the Slack configuration file ('slack.json').
Every app requires a 'slack.json' file and you can find a working example at:
https://github.com/slack-samples/deno-starter-template/blob/main/slack.json

[2024-05-05 11:05:58] FlushToLogstash will POST https://slackb.com/events/cli payload: [{"context":{"bin":"...\\AppData\\Local\\slack-cli\\bin\\slack.exe","cli_version":"2.23.0","command":"run","command_canonical":"platform run","flags":["verbose"],"host":"4fc9d945bbce3e93291794bdcd9cbadb301e8010","os":"windows","project_id":"cd3390af-da66-4274-89c1-2c4aeb79d6f5","runtime":"Deno","runtime_version":"v1.43.1","session_id":"042c7c30-a1cb-4d58-ba57-e03b2c6efca0","system_id":"bee42360-9bdf-4b9a-8dab-e9125db24be5"},"data":{"app":{},"auth":{"user_id":"U071N4057B7"},"error_code":"sdk_hook_not_found","error_msg":"The `start` script was not found (sdk_hook_not_found)\n\nSuggestion:\n\nHook scripts are defined in the Slack configuration file ('slack.json').\nEvery app requires a 'slack.json' file and you can find a working example at:\nhttps://github.com/slack-samples/deno-starter-template/blob/main/slack.json\n"},"event":"error","timestamp":1714899958974}]
[2024-05-05 11:05:59] FlushToLogstash response status code: 200, body: ok
Equirinya commented 2 months ago

Very similar to this reddit thread: https://www.reddit.com/r/Slack/comments/1btrarr/please_test_my_open_ai_slack_bot/

hello-ashleyintech commented 2 months ago

Hi, @Equirinya! I have just merged in some dependency updates in this PR for this template: https://github.com/slack-samples/deno-starter-template/pull/64, could you try to follow the quickstart guide again to create a new app and run it and see if you get the same errors?

whogodemo commented 2 months ago

I have exactly same error with @Equirinya. @hello-ashleyintech I created a new app and run it but I got the same error:The start script was not found (sdk_hook_not_found) The slack.json file is present and looks like this: { "hooks": { "get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.0/mod.ts" } }

hello-ashleyintech commented 2 months ago

Hi, @whogodemo!

How recently did you create this new app?

Equirinya commented 2 months ago

Unfortunately its the same error still @hello-ashleyintech

zimeg commented 2 months ago

👋 This might be caused by the PowerShell version being used with CLI implementations of hook execution, but not the actual hook implementations. The exec: "pwsh": executable file not found hints that the PowerShell version installed is less than 6.0 while support for pwsh is added in 6.0. Right now this is the minimum version supported by the CLI.

If you're using PowerShell could you check the version you're using? I'm wondering if this might be causing this issue and if bumping to a more recent version is possible?

AHTA commented 1 month ago

Alo alo 😃

I want to confirm that I solved the problem updating to PowerShell 7; you can't check your PS version running.

$PSVersionTable

If you want to install the latest version of PS

https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4#installing-the-msi-package

bombastictranz commented 1 month ago

Stock control supervisors