sdk_hook_not_found when following Quick-Start
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/[email protected]/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
Very similar to this reddit thread: https://www.reddit.com/r/Slack/comments/1btrarr/please_test_my_open_ai_slack_bot/
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?
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/[email protected]/mod.ts" } }
Hi, @whogodemo!
How recently did you create this new app?
Unfortunately its the same error still @hello-ashleyintech
👋 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?
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
I got the same issue on macOS, here are my slack doctor outputs
✘ 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`
There are few notes in the docs but I'm pretty sure my deno-slack-hooks is v1.3.0
Because this is my slack.json file
{
"hooks": {
"get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts"
}
}
Does anyone know how to solve this issue 😢
@tult98 The contents of slack.json look good to me, but it might be possible that the deno command isn't being found in you $PATH 🤔 Could you try running just the following command to see if it outputs JSON that starts with {"runtime": "deno", ...?
$ deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts
I'd also be interested in the debug logs shown with a command like slack run -v since the following should be shown early in the execution:
[2024-07-27 11:14:15] 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/[email protected]/b
uild.ts Name:BuildProject} CheckUpdate:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/[email protected]/check_update.ts Name:CheckUpdate} Deploy:{Command: Name:Deploy} Doctor:{Command:deno
run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/[email protected]/doctor.ts Name:Doctor} GetHooks:{Command:deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts Name:Get
Hooks} GetManifest:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/[email protected]/get_manifest.ts Name:GetManifest} GetTrigger:{Command:deno run -q --config=deno.jsonc --allo
w-read --allow-net --allow-env https://deno.land/x/[email protected]/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/
[email protected]/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/[email protected]/local-run.ts Name:Start}} Con
fig:{Watch:{FilterRegex:\.(ts|js)$ Paths:[.]} SDKManagedConnection:false TriggerPaths:[] SupportedProtocols:[message-boundaries]} WorkingDirectory:}
I'm hoping one of these point towards another issue or a fix, but please let me know if the responses seem unexpected!
Thanks for the quick response @zimeg
Here are the outputs from deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts command. It might be the problem here 🤔
error: Import 'https://deno.land/x/[email protected]/mod.ts' failed: client error (Connect)
And the outputs from slack run -v
[2024-07-28 07:26:44] FlushToLogstash will POST https://slackb.com/events/cli payload: [{"context":{"bin":"slack","cli_version":"2.28.0","command":"run","command_canonical":"platform run","flags":["verbose"],"host":"54f03ef1feb4a887ed15e32389ea80c14e5599d4","os":"darwin","project_id":"b3aa1650-e53c-4a54-9957-9f6a66834a41","runtime":"Deno","runtime_version":"v1.45.4","session_id":"2a5b5c6b-c2ea-4803-ac95-79e1505ac7b0","system_id":"526c18bb-67b9-4127-bde5-474839e44665"},"data":{"app":{},"auth":{"user_id":"U07EQ55Q9H7"},"error_code":"sdk_hook_not_found","error_msg":"The `start` script was not found (sdk_hook_not_found)\n\n💡 Suggestion\n Hook scripts are defined in the Slack configuration file ('slack.json').\n Every app requires a 'slack.json' file and you can find a working example at:\n https://github.com/slack-samples/deno-starter-template/blob/main/slack.json\n"},"event":"error","timestamp":1722126404044}]
[2024-07-28 07:26:44] FlushToLogstash response status code: 200, body: ok
@tult98 Interesting 👀 This might be VPN or network settings blocking a connection to https://deno.land 🦕
Wanting to rule a few things out- are you connected through a VPN? And does the following command on the same machine work for you?
$ deno run https://deno.land/x/[email protected]/cowsay.ts -t="greetings"
ah yes, I did use a VPN, it might be the problem. Let me turn off the VPN and try again. Thanks for your support 🙏
are you connected through a VPN
No, it doesn't
does the following command on the same machine work for you?
hey guys, I got the same problem now.... I'm pretty sure my PowerShell is the newest version(7.4.4).
Here is the problem:
The `start` script was not found (sdk_hook_not_found)
Here is my Slack doctor result:
✘ Runtime (foundations for the application)
Error: The `doctor` hook was not found (sdk_hook_not_found)
✘ Dependencies (requisites for development)
Error: The `check-update` hook was not found (sdk_hook_not_found)
And my slack.json code:
{
"hooks": {
"get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts"
}
}
Did anyone solve this problem already? Thank you!!
@as43647 👋 Hi! Which version of the CLI is this happening with? My first guess is that the deno command is not being found but this might be related to how PowerShell and the CLI communicate when the hooks are called 🤔
Hi @zimeg !! My version is slack.exe v2.29.1
yeah I run the deno command and it starts with {"runtime": "deno", ...
I also run slack run -v and it shows:
Details
[2024-08-16 18:07:01] Resolving logstash host, https://slack.com, 2.29.1 [2024-08-16 18:07:01] system_id: fb7a886f-a7d2-404f-850a-972acdd6013d [2024-08-16 18:07:01] project_id: 30812829-09b0-4be6-abf2-2e08bf9a2050 [2024-08-16 18:07:01] active flag experiments: [] [2024-08-16 18:07:01] active project experiments: [] [2024-08-16 18:07:01] active system experiments: [] [2024-08-16 18:07:01] reading credentials file [2024-08-16 18:07:01] found authorizations at C:\Users\as436.slack\credentials.json reading [2024-08-16 18:07:02] failed to initialize slack.json configurations: invalid character '.' looking for beginning of value [2024-08-16 18:07:02] initialize runtime from auto-detect: Deno (v1.45.5) [2024-08-16 18:07:02] reading credentials file [2024-08-16 18:07:02] found authorizations at C:\Users\as436.slack\credentials.json reading ? Choose a local environment Install to a new team ? Install to a new team w1722928218-tjj244093 T07FNGSBC59
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-08-16 18:07:05] HTTP Request: POST https://slack.com/api/auth.test HTTP/1.1
HTTP Request Body:
token=...
[2024-08-16 18:07:05] HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"url":"https://w1722928218-tjj244093.slack.com/","team":"\u65b0\u7684\u5de5\u4f5c\u7a7a\u9593","user":"...","team_id":"T07FNGSBC59","user_id":"U07FR4T1KRS","expires_in":22039,"is_enterprise_install":false}
[2024-08-16 18:07:05] reading credentials file
[2024-08-16 18:07:05] found authorizations at C:\Users\as436.slack\credentials.json reading
[2024-08-16 18:07:05] Resolving logstash host, https://slack.com, 2.29.1
[2024-08-16 18:07:05] HTTP Request: POST https://slack.com/api/auth.test HTTP/1.1
HTTP Request Body:
token=...
[2024-08-16 18:07:06] HTTP Response Status: HTTP/1.1 200 OK
HTTP Response Body:
{"ok":true,"url":"https://w1722928218-tjj244093.slack.com/","team":"\u65b0\u7684\u5de5\u4f5c\u7a7a\u9593","user":"...","team_id":"T07FNGSBC59","user_id":"U07FR4T1KRS","expires_in":22039,"is_enterprise_install":false}
[2024-08-16 18:07:06] Starting root command cleanup routine
Check C:\Users\as436.slack\logs\slack-debug-20240816.log for 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-08-16 18:07:06] FlushToLogstash will POST https://slackb.com/events/cli payload: [{"context":{"bin":"...\AppData\Local\slack-cli\bin\slack.exe","cli_version":"2.29.1","command":"run","command_canonical":"platform run","flags":["verbose"],"host":"978c8bba38c9a4f024a5cb28d420fb807d34b89f","os":"windows","project_id":"30812829-09b0-4be6-abf2-2e08bf9a2050","runtime":"Deno","runtime_version":"v1.45.5","session_id":"062d2a88-e0b7-4269-8086-3e7a208fdf21","system_id":"fb7a886f-a7d2-404f-850a-972acdd6013d"},"data":{"app":{},"auth":{"user_id":"U07FR4T1KRS"},"error_code":"sdk_hook_not_found","error_msg":"The start script was not found (sdk_hook_not_found)\n\n\u003e Suggestion\n Hook scripts are defined in the Slack configuration file ('slack.json').\n Every app requires a 'slack.json' file and you can find a working example at:\n https://github.com/slack-samples/deno-starter-template/blob/main/slack.json\n"},"event":"error","timestamp":1723802826124}]
[2024-08-16 18:07:06] FlushToLogstash response status code: 200, body: ok
FYI I'm using Windows. Thank you!!
@as43647 🤔 Hmm... For pedantics does the deno run response match the following and parse as valid JSON?
{
"runtime": "deno",
"hooks": {
"get-manifest": "deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/[email protected]/get_manifest.ts",
"get-trigger": "deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/[email protected]/get_trigger.ts",
"build": "deno run -q --config=deno.jsonc --allow-read --allow-write --allow-net --allow-run --allow-env https://deno.land/x/[email protected]/build.ts",
"start": "deno run -q --config=deno.jsonc --allow-read --allow-net --allow-run --allow-env https://deno.land/x/[email protected]/local-run.ts ",
"check-update": "deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/[email protected]/check_update.ts",
"install-update": "deno run -q --config=deno.jsonc --allow-run --allow-read --allow-write --allow-net https://deno.land/x/[email protected]/install_update.ts",
"doctor": "deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/[email protected]/doctor.ts"
},
"config": {
"protocol-version": [
"message-boundaries"
],
"watch": {
"filter-regex": "\\.(ts|js)$",
"paths": [
"."
]
}
}
}
Asking because this line is a bit suspicious with the invalid . character!
[2024-08-16 18:07:02] failed to initialize slack.json configurations: invalid character '.' looking for beginning of value
This might also be caused by the environment you're running slack and deno in. It's possible that a debugger or similar program is adding additional output to the deno command and causing unexpected parsings with the CLI 🤔
If the output above matches and these commands are run with the same path and shell, I'll be a bit stumped but we'll of course continue investigations! :mag:
Hey @zimeg ~
My Deno version is:
deno 1.45.5 (release, x86_64-pc-windows-msvc)
v8 12.7.224.13
typescript 5.5.2
There are some different between two json file deno_slack_hooks and deno_slack_runtime. Both are different version. Should I upgrade them? (my version are 1.3.0 and 1.1.1 btw)
Thank u!!
@as43647 👀 All of those versions seem alright to me! It is notable that Windows is being used, but I don't believe that should be causing a problem...
Can you share the outputs from these commands when running in a project directory?
$ deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts
$ deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/[email protected]/get_manifest.ts
$ slack manifest
I'm hoping to figure out if this is caused by deno or how the CLI is interpreting the "hook" responses 🤔
Hi @zimeg
Here is my output:
deno run -q --allow-read --allow-net https://deno.land/x/[email protected]/mod.ts
Details
{"runtime":"deno","hooks":{"get-manifest":"deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/[email protected]/get_manifest.ts","get-trigger":"deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/[email protected]/get_trigger.ts","build":"deno run -q --config=deno.jsonc --allow-read --allow-write --allow-net --allow-run --allow-env https://deno.land/x/[email protected]/build.ts","start":"deno run -q --config=deno.jsonc --allow-read --allow-net --allow-run --allow-env https://deno.land/x/[email protected]/local-run.ts ","check-update":"deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/[email protected]/check_update.ts","install-update":"deno run -q --config=deno.jsonc --allow-run --allow-read --allow-write --allow-net https://deno.land/x/[email protected]/install_update.ts","doctor":"deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/[email protected]/doctor.ts"},"config":{"protocol-version":["message-boundaries"],"watch":{"filter-regex":"\.(ts|js)$","paths":["."]}}}
deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env
Details
https://deno.land/x/[email protected]/get_manifest.ts` {"_metadata":{"major_version":2},"display_information":{"name":"hello-world-app","description":"A blank template for building Slack apps with Deno"},"icon":"assets/default_new_app_icon.png","oauth_config":{"scopes":{"bot":["commands","chat:write","chat:write.public"]},"token_management_enabled":false},"features":{"bot_user":{"display_name":"hello-world-app"},"app_home":{"messages_tab_enabled":true,"messages_tab_read_only_enabled":true}},"settings":{"function_runtime":"slack","org_deploy_enabled":true},"functions":{},"workflows":{},"outgoing_domains":[]}
slack manifest
Details
Check C:\Users\as436.slack\logs\slack-debug-20240822.log for error logs
The manifest 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
Thank you!
Over a year in and still an issue
@stephenhuh We've since improved verbose logging with the CLI and it still isn't clear what causes this error.
Could you share the outputs of the following command?
$ slack manifest --verbose
Sometimes these errors occur due to the Deno version or OS being used and these details are helpful to include!
Bit of a mess really. The quickstart docs and/or troubleshooting section could definitely use an update.
I ran into this same problem on OSX. The issue is mainly the way the docs are telling you to install the CLI (and/or the lack of useful info in the Troubleshooting section).
Issue encountered:
- Per quickstart docs, executed the install.sh script using:
curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash - This errored due to permissions and not being able to create the
slacksymlink in/usr/local/bin- As per troubleshooting section of link above, tried re-running the install prefixed with
sudo- despite what docs say, this still throws the same permission error
- As per troubleshooting section of link above, tried re-running the install prefixed with
- Created symlink manually using
sudo ln -sf "/Users/myusername/.slack/bin/slack" "/usr/local/bin/slack" - Was able to successfully
slack loginandslack createthe starter app using this template (slack create slack-app --template https://github.com/slack-samples/deno-starter-template) - Now finally:
slack runthrows the same "Thestartscript was not found (sdk_hook_not_found)" error that led me to this issue
The following is how I got around this - hopefully of use to someone else too:
- Manually download the install.sh script,
chmod +x install.sh && sudo ./install.sh- This now errored due to Deno not being installed:
Installing Deno using Homebrew... Error: Running Homebrew as root is extremely dangerous and no longer supported.
- This now errored due to Deno not being installed:
- Checked the
install.shand installed Deno as per their:brew install deno(note - requires Homebrew) -
slack run👍