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

Slack CLI Install Not Persisting in Github Codespace #272

Closed
anthonygualandri opened this issue Feb 7, 2024 · 10 comments
Closed

Slack CLI Install Not Persisting in Github Codespace #272

anthonygualandri opened this issue Feb 7, 2024 · 10 comments
Labels
question Further information is requested

Comments

@anthonygualandri
Copy link

Question

I followed the install instructions in the help files and received the same error described here. I used sudo su root and the curl installed successfully, but now I can only use the slack cli if I change users to root and if I update my devcontainer config file and rebuild the container the install doesn't persist in my codespace. Is there a way to get around this? Also, is there a way to not have to switch to the root user every time?

Context

Environment

Github Codespace

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.

@anthonygualandri
Copy link
Author

I also get this vs code error every time the codespace starts up (assuming because I'm not initially logged in as the root user) (see attachments below).
Screenshot 2024-02-07 at 2 03 26 PM
Screenshot 2024-02-07 at 2 03 39 PM

@zimeg zimeg added the question Further information is requested label Feb 8, 2024
@zimeg
Copy link
Member

zimeg commented Feb 8, 2024

Hey @anthonygualandri 👋 Neat to hear that you're using the CLI in a Codespace 🚀 There are a few ideas we can try to get around needing to install with sudo and the Deno error, and also a few questions I have! If you can share the dev container configurations you're using that'd be helpful too!

By the time you get to the "Failed to create a symbolic link!" error, the CLI should be installed but wouldn't be quite ready to use. You can check to see if the slack binary is installed with ls ~/.slack/bin but let me know if it's not showing up!

At this point if the CLI is installed, instead of using sudo with the curl command, could you try these commands to prepare the command:

$ sudo mkdir -p -m 775 /usr/local/bin
$ sudo ln -sf ~/.slack/bin/slack /usr/local/bin/slack

This should add slack to your $PATH without needing to use sudo. If all goes well, slack version should print a version around v2.17.1

...if I update my devcontainer config file and rebuild the container the install doesn't persist in my codespace.

I think this is expected if slack isn't defined in your dev container / Dockerfile, but I'm not entirely sure 🤔 Do you know if this happens with other commands installed with curl?

And the Deno error seems related to how the CLI is being installed with root since the installation script currently installs Deno along with the CLI. Perhaps a Deno installation can be added to your dev container or Deno can be installed before trying the installation script?

Hopefully some of this is helpful, but please let me know if errors continue. I'm happy to help work through this one!

@anthonygualandri
Copy link
Author

anthonygualandri commented Feb 8, 2024

Thanks so much @zimeg for the help! So I did try to prep the command like you note here (which was also noted in the troubleshooting section of the help page), but after running those commands the same error happens saying no permissions. Below is my dev container config.

{
  "name": "Slack Apps",
  "image":"mcr.microsoft.com/devcontainers/universal:2",
  "customizations": {
    "vscode": {
      "extensions": [
        "denoland.vscode-deno",
        "dracula-theme.theme-dracula"
      ]
    }
  }
}

@anthonygualandri
Copy link
Author

I do think the first issue (Slack CLI install) is the cause of the second (Deno not quite working right). I found some info on the Deno side about installing into a codespace here, but unfortunately their recommendation of adding Deno to the dev container I can't get to work. It keeps saying the template can't be loaded.

@zimeg
Copy link
Member

zimeg commented Feb 8, 2024

@anthonygualandri I found that setting up a Dockerfile with Deno then creating a custom user and installing the CLI works well - feel free to reference this!

That Dockerfile might be a little heavy if you're just wanting to use Deno, so the other languages can probably be removed, but the tool installations and user setup seem to work as is. Slack logins might also not persist across container rebuilds, but any app installations and changes to code should be good.

I also think it's pretty cool to run an app from the browser! 🚀

I had some trouble setting up the denoland.vscode-deno extension, but I left a note in the README.md if you want to give this a try! I think the monorepo setup makes things weird... Please let me know if any of this is giving you trouble!

@anthonygualandri
Copy link
Author

Thansk so much @zimeg, I think it's all working now! I am still getting a vscode error on the slack seek import (see attached screenshot). I'm not sure if this has to do with the Deno extension or not. Do you know how exactly to test whether it's working or not? If it's not the extension any idea how this error can be resolved?image

@zimeg
Copy link
Member

zimeg commented Feb 8, 2024

Awesome! 😄 That was the same error I was running into and I think it's related to the Deno extension. I tried restarting the Deno language server and refreshing the Deno cache from the command palette a few times without much luck... Maybe I was unlucky though?

It seems like you do have the extension installed though which is good to see!

You might try configuring your repo as a VS Code workspace and/or configuring project paths from the Deno extension:

This could maybe work for the directory structure you have setup? And I haven't tried this with a single-project in the repo root, but I feel like that would just work? ✨

If it does, it'd be super great to know what the magic touch is. I'm not super familiar with the nuance of this editor but maybe this is a known problem with the Deno extension and multiple subdirectories/projects?

@anthonygualandri
Copy link
Author

Thanks again @zimeg. I think I resolved the issue with the extension, in case you want to know. I went to the Deno GitHub repository and searched for the error I was getting in vs code. Turns out, others asked about it and it does have to do with sub directory nature of the way vs code sets up the codespace project. Here's the repo issue #20210 url so you can check it out. I added enabling the cache on save for deno so that imports like that are resolved automatically. Thanks again for all your help with this. You efforts definitely got me father quicker than I would have on my own! Really appreciate the time!

@anthonygualandri
Copy link
Author

One other thing to note on getting the deno extension to persist when restarting the codespace. After you install it you need to right click on it in the extensions panel and then from the menu select to add it to the .devcontainer.json file. Then it will load in every time. I guess it doesn't do this when you just install the extension.

@zimeg
Copy link
Member

zimeg commented Feb 10, 2024

@anthonygualandri and thank you for digging around for a fix! This is super helpful! Re: the missing extension on restarts, I think you can also update the devcontainer.json file to always include this on startup. Restarting a container seems to wipe everything not included in the container setup or git file tree, so a missing extension might make sense here 👀

Going to close this issue since the Codespace is working, but feel free to add anything else! Thanks again for working on this too! 👏

@zimeg zimeg closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants