You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Various commands are not working in CI context since version 2.33.0. #218
We are running on AWS Lambda, specifically in Pipedream.
sw_vers: command not found uname -v: #1 SMP Wed Jan 22 02:58:04 UTC 2025
Describe the bug
We always get this error, even though the file clearly exists:
This is an invalid Slack app project directory (invalid_app_directory)
Suggestion
A valid Slack project includes the Slack hooks file: .slack/hooks.json
Steps to reproduce
slack activity -w something -a deployed --skip-update --no-color --token $SLACK_DATABOT_TOKEN
SYSTEM
✔ Operating System (the computer conductor)
Version: linux (amd64)
✔ Git (a version control system)
Version: git version 2.40.1
SLACK
✔ CLI (this tool for building Slack apps)
Version: v3.0.0
✔ Configurations (any adjustments to settings)
System ID: 31ec8d9e-b4c1-4958-9a80-065fcdb2f3f4
Last updated: 0001-01-01 00:00:00 Z
Experiments: bolt
✘ Credentials (your Slack authentication)
Error: You are either not logged in or your login session has expired (not_authed)
Suggestion: Authorize your CLI with `slack login`
Errors: 1
No credentials (as expected) since this is a CI context (so using --token instead).
Hey @mroy-seedbox 👋🏻 I'm deeply sorry that your deployment setup is affected by this bug 😢 But thank you for including so much detail!
We'll look into reproducing your problem and double-checking the other commands with the --token flag. We'll aim to have a fix available in the next release and I can loop around on this issue when it's available.
Without the Slack CLI being open sourced, it's been challenging to get the rich feedback that you provided in this issue. While we have unit test coverage and a E2E test pipeline, these issues can still slip through - unfortunately. On the upside, we've got the go-ahead to open source the Slack CLI, so hopefully we can provide more detailed release information and a dedicated issue tracker for feedback.
In the most recent v3.0.1 we tested and fixed a handful of flag combinations including those with the --token flag for Slack CLI support in a CI context:
And I'm hoping to call out the root directory here since v2.33.0 - the release after v2.32.2 - made a change to search upwards for a .slack/hooks.json file if a slack command is run, but that might cause problems with certain commands and hook responses 🐟
The Lambda Pipedream setup you shared is quite interesting to me though also somewhat unfamiliar at the moment. Is it possible to check if the latest changes work alright in your scripts and setup?
I do hope this issue might be related to flag combinations, but please let me know if the same errors continue! I'm hoping this and following updates continue to find improvements for CI setups, and your comments are so helpful in this! 🙏
We just tried version 3.0.1, but we're still getting the same error. 😞
This is an invalid Slack app project directory (invalid_app_directory)
Suggestion
A valid Slack project includes the Slack hooks file: .slack/hooks.json
However, I cannot reproduce the issue locally. It works when I run the exact same command on my laptop (whether with a token or with slack login). So it must have something to do with the environment. But without seeing the code, I can't be of any more help to debug this issue.
And we are always running everything from the project root directory.
@zimeg: Could it be due to the Slack CLI expecting to find a home directory in the environment (i.e. ~/.slack/...)? Because there is no home directory in PIpedream (only a /tmp folder we can use). So right now we're using export SLACK_CONFIG_DIR=/tmp/slack (which is also where the Slack CLI bin is located, just like in our local home directory).
@mroy-seedbox Hmm... It's interesting to know this might be an issue in available directories 🔍
A changed SLACK_CONFIG_DIR environment variable shouldn't cause this error to appear - I cannot find this error with a similar setup on my machine.
Is it possible to share some of the logs when running this command? I'm wondering if the initial hook parsing is failing or if this might caused within another call:
$ SLACK_CONFIG_DIR=/tmp/slack slack activity --token $SLACK_CLI_TOKEN --app $SLACK_APP_ID -v
...
[2025-03-19 16:05:13] found authorizations at /tmp/slack/credentials.json reading
[2025-03-19 16:05:13] starting hook command: deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/mod.ts
[2025-03-19 16:05:13] {"runtime":"deno","hooks":{"get-manifest":"deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env --allow-sys=osRelease https://deno.land/x/deno_slack_hooks@1.3.2/get_manifest.ts","get-trigger":"deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env https://deno.land/x/deno_slack_hooks@1.3.2/get_trigger.ts","build":"deno run -q --config=deno.jsonc --allow-read --allow-write --allow-net --allow-run --allow-env --allow-sys=osRelease https://deno.land/x/deno_slack_hooks@1.3.2/build.ts","start":"deno run -q --config=deno.jsonc --allow-read --allow-net --allow-run --allow-env --allow-sys=osRelease https://deno.land/x/deno_slack_runtime@1.1.2/local-run.ts ","check-update":"deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/check_update.ts","install-update":"deno run -q --config=deno.jsonc --allow-run --allow-read --allow-write --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/install_update.ts","doctor":"deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/doctor.ts"},"config":{"protocol-version":["message-boundaries"],"watch":{"filter-regex":"\\.(ts|js)$","paths":["."]}}}
[2025-03-19 16:05:13] finished hook command: deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/mod.ts
[2025-03-19 16:05:13] 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 --allow-sys=osRelease https://deno.land/x/deno_slack_hooks@1.3.2/build.ts Name:BuildProject} CheckUpdate:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/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/deno_slack_hooks@1.3.2/doctor.ts Name:Doctor} GetHooks:{Command:deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.3.2/mod.ts Name:GetHooks} GetManifest:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net --allow-env --allow-sys=osRelease https://deno.land/x/deno_slack_hooks@1.3.2/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.3.2/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.3.2/install_update.ts Name:InstallUpdate} Start:{Command:deno run -q --config=deno.jsonc --allow-read --allow-net --allow-run --allow-env --allow-sys=osRelease https://deno.land/x/deno_slack_runtime@1.1.2/local-run.ts Name:Start}} Config:{Watch:{FilterRegex:\.(ts|js)$ Paths:[.]} SDKManagedConnection:false TriggerPaths:[] SupportedProtocols:[message-boundaries]} WorkingDirectory:}
[2025-03-19 16:05:13] initialize runtime from hooks.json: Deno (v2.2.3)
...
It's also not so clear from the error, but the expected hooks.json file will be in the .slack directory of your project and not the system SLACK_CONFIG_DIR environment variable value. If the above is erroring with something else is it possible to check this too? 👁🗨
Is that what we should do going forward, or is this something that you will fix on your end?
Also, surfacing that error message (about the $HOME directory) would have been much more useful than the one about hooks.json not being found! Especially since hooks.json should not be located in the home directory! 😅
@mroy-seedbox Wow! I haven't seen this error before, but agree that it should be surfaced to make remediation more clear!
I'm also not super sure why $HOME is checked if SLACK_CONFIG_DIR is being set... To me this seems like a bug. I'm guessing it might be related to the upward searching .slack/hooks.json though, since we're stopping at $HOME if hooks weren't found. I don't think we've encountered an unset $HOME variable before 😅
Thinking aloud, I'm not certain how an unset $HOME or project not within the $HOME directories might behave with upwards searches?
It might be easiest to not search upwards in these cases, but perhaps a SLACK_PROJECT_DIR variable could later allow this? I'd be interested to know your thoughts!
📝 To note, I'm hoping we can fix errors from an unset $HOME on the CLI side of things, but for now the workaround you're sharing is a solid patch! We'll share more updates on this soon too, but also let me know of other ideas-
.slack/hooks.json should exist within the project that is being executed, so we shouldn't need to search any higher than the project root.
And as you suggested, a SLACK_PROJECT_DIR might make this more explicit.
But we should also be able to identify the root by locating the .slack folder, especially if it is in the current directory (no searching required). So not searching upward would support this.
And if a $HOME directory is not found, maybe just default to / as the home/root for those environment?
SLACK_CONFIG_DIR is a completely separate concern. And when it is specified, it should override directory searching (if any).
Although in theory, SLACK_CONFIG_DIR and the project itself can/should be in two completely different places, so I'm not sure why any directory searching would be required for this. 🤔
So ignore my previous message (now that I understand the issue better): "Also, it's weird that it even looks for $HOME (or that it is required at all) when we have already specified SLACK_CONFIG_DIR."
Activity
mroy-seedbox commentedon Feb 28, 2025
The issue initially appeared in version
2.33.0.Unfortunately, version
3.0.0did not resolve the issue. 😞Related:
mroy-seedbox commentedon Feb 28, 2025
Output from
slack doctor:No credentials (as expected) since this is a CI context (so using
--tokeninstead).mwbrooks commentedon Feb 28, 2025
Hey @mroy-seedbox 👋🏻 I'm deeply sorry that your deployment setup is affected by this bug 😢 But thank you for including so much detail!
We'll look into reproducing your problem and double-checking the other commands with the
--tokenflag. We'll aim to have a fix available in the next release and I can loop around on this issue when it's available.Without the Slack CLI being open sourced, it's been challenging to get the rich feedback that you provided in this issue. While we have unit test coverage and a E2E test pipeline, these issues can still slip through - unfortunately. On the upside, we've got the go-ahead to open source the Slack CLI, so hopefully we can provide more detailed release information and a dedicated issue tracker for feedback.
mroy-seedbox commentedon Feb 28, 2025
Oh, I would've definitely submitted a PR if it were open source!! Can't wait! 😄 🙌 🚀
And thanks for the response. 🙏
In the meantime, we're pinned on
2.32.2, so not the end of the world.zimeg commentedon Mar 19, 2025
@mroy-seedbox Thanks for sending this in! 👾 ✨
In the most recent
v3.0.1we tested and fixed a handful of flag combinations including those with the--tokenflag for Slack CLI support in a CI context:$ curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash -s -- -v 3.0.1With the latest update I'm finding that this command no longer errors when run in the project's root directory:
And I'm hoping to call out the root directory here since
v2.33.0- the release afterv2.32.2- made a change to search upwards for a.slack/hooks.jsonfile if aslackcommand is run, but that might cause problems with certain commands and hook responses 🐟The Lambda Pipedream setup you shared is quite interesting to me though also somewhat unfamiliar at the moment. Is it possible to check if the latest changes work alright in your scripts and setup?
I do hope this issue might be related to flag combinations, but please let me know if the same errors continue! I'm hoping this and following updates continue to find improvements for CI setups, and your comments are so helpful in this! 🙏
mroy-seedbox commentedon Mar 19, 2025
We just tried version
3.0.1, but we're still getting the same error. 😞However, I cannot reproduce the issue locally. It works when I run the exact same command on my laptop (whether with a token or with
slack login). So it must have something to do with the environment. But without seeing the code, I can't be of any more help to debug this issue.And we are always running everything from the project root directory.
mroy-seedbox commentedon Mar 19, 2025
@zimeg: Could it be due to the Slack CLI expecting to find a home directory in the environment (i.e.
~/.slack/...)? Because there is no home directory in PIpedream (only a/tmpfolder we can use). So right now we're usingexport SLACK_CONFIG_DIR=/tmp/slack(which is also where the Slack CLI bin is located, just like in our local home directory).zimeg commentedon Mar 19, 2025
@mroy-seedbox Hmm... It's interesting to know this might be an issue in available directories 🔍
A changed
SLACK_CONFIG_DIRenvironment variable shouldn't cause this error to appear - I cannot find this error with a similar setup on my machine.Is it possible to share some of the logs when running this command? I'm wondering if the initial hook parsing is failing or if this might caused within another call:
It's also not so clear from the error, but the expected
hooks.jsonfile will be in the.slackdirectory of your project and not the systemSLACK_CONFIG_DIRenvironment variable value. If the above is erroring with something else is it possible to check this too? 👁🗨Edit: Oh I copied the wrong command altogether...
mroy-seedbox commentedon Mar 19, 2025
Ah, how did I not think about that before! 🤦♂
Here are the logs, which confirm that it is an issue with a missing home directory:
Specifically this error:
failed to initialize hook configurations: $HOME is not defined.And yes, our
hooks.jsonis located within the project (not the config dir). 👍mroy-seedbox commentedon Mar 19, 2025
And when I add
export HOME=/tmp, it works! 🎉Is that what we should do going forward, or is this something that you will fix on your end?
Also, surfacing that error message (about the
$HOMEdirectory) would have been much more useful than the one abouthooks.jsonnot being found! Especially sincehooks.jsonshould not be located in the home directory! 😅mroy-seedbox commentedon Mar 20, 2025
Also, it's weird that it even looks for
$HOME(or that it is required at all) when we have already specifiedSLACK_CONFIG_DIR.Why is a home directory even necessary?
zimeg commentedon Mar 20, 2025
@mroy-seedbox Wow! I haven't seen this error before, but agree that it should be surfaced to make remediation more clear!
I'm also not super sure why
$HOMEis checked ifSLACK_CONFIG_DIRis being set... To me this seems like a bug. I'm guessing it might be related to the upward searching.slack/hooks.jsonthough, since we're stopping at$HOMEif hooks weren't found. I don't think we've encountered an unset$HOMEvariable before 😅Thinking aloud, I'm not certain how an unset
$HOMEor project not within the$HOMEdirectories might behave with upwards searches?It might be easiest to not search upwards in these cases, but perhaps a
SLACK_PROJECT_DIRvariable could later allow this? I'd be interested to know your thoughts!📝 To note, I'm hoping we can fix errors from an unset
$HOMEon the CLI side of things, but for now the workaround you're sharing is a solid patch! We'll share more updates on this soon too, but also let me know of other ideas-mroy-seedbox commentedon Mar 20, 2025
Well, I see two distinct issues here:
.slack/hooks.jsonshould exist within the project that is being executed, so we shouldn't need to search any higher than the project root.SLACK_PROJECT_DIRmight make this more explicit..slackfolder, especially if it is in the current directory (no searching required). So not searching upward would support this.$HOMEdirectory is not found, maybe just default to/as the home/root for those environment?SLACK_CONFIG_DIRis a completely separate concern. And when it is specified, it should override directory searching (if any).SLACK_CONFIG_DIRand the project itself can/should be in two completely different places, so I'm not sure why any directory searching would be required for this. 🤔"Also, it's weird that it even looks for $HOME (or that it is required at all) when we have already specified SLACK_CONFIG_DIR."