Repository navigation
How can I back out of install slack app? As you gave installation_store/authorize as well, token will be unused. #256
Description
Activity
- addedquestionFurther information is requestedFurther information is requested
on Mar 9, 2021 Hi @Roblrobl, we're glad to know you like Bolt and you have been enjoying Slack app development!
As you gave installation_store/authorize as well, token will be unused.
This warning message indicates your
Appconstructor got bothinstallation_storeandtokenarguments during its initialization.tokenhere is specifically thetokenargument in theAppconstructor. Thetokencould be passed either as the explicit argument or via env variables. I guess this is the latter pattern.a) Is there an easy way to back this out? I removed the extra configs on app settings. Didn't work. Do I need to completely uninstall the app?
So, a quick answer is "You can run
unset SLACK_BOT_TOKENto suppress the warning!".Appconstructor usestokenargument if exists. If the arg doesn't exist, the constructor tries to loadSLACK_BOT_TOKENenv variable for it. I'm sure that your shell should have the env variable in the shell session. This warning is for better developer friendliness but I'm sorry for making you confused.c) Any other suggestions on how to segregate production vs. test apps when only used internally?
I do understand this is crucial for better development productivity and also for making app management more secure and organized. At this point, the safest way is to create another Slack app for the tests and development. This is the approach you've already mentioned this way:
One workaround could be to create the slack app all over again in a development slack workspace, then juggle the startup to handle different sets of configuration data.
Although I cannot tell anything at this point, the Slack Platform team has been actively discussing better developer experience of Slack apps. The Slack team may be able to come up with some solution sometime in the future but, until then, please go with having multiple Slack apps.
I hope this was helpful to you!
Hello again @seratch and thank you again for the quick response and good information. For dev/production, I will try to use multiple slack apps once I get this working again.
One thing that puzzled me was that I didn't actively pass an installation_store to the App() constructor. I had only called app=App(token=xyz) and could see no such constructs in my app folder, and no environment variables for an install store. All I had done was look at the "add to slack" requests/response and basically did nothing with the data and then my app stopped working. It runs with the warning above, but doesn't get any events from slack.
--> update, I found if both the SLACK_CLIENT_ID and SLACK_CLIENT_SECRET env vars are set, it looks like you're assuming an installation_store is used and setting it up? If I remove one of those env vars, the warning goes away. One suggestion: if you're assuming and creating installation_store objects for us (vs passing to constructor), change the warning message to reflect it. Perhaps something like: Warning: the env vars x & y were found, so we created an installation_store object for you, but that conflicts with token, so token was ignore. Please remove one of those vars if you want to use token.
Finally a quick architecture question. If an app is added to multiple workspaces, does a single App() call to bolt register them all at once? And then a need to look at both team_id and user_id in the callbacks? Or instead does one startup a new process, one process per workspace? If it needs a process per workspace, how does this work ok with Apache/mod_wsgi in how it wants to setup # threads and processes in the apache config?
Finally, if we ever did go to slack enterprise, and our bot EventBot was used by the same person across multiple workspaces, it would be nice if a user could login to our internal website and see a comprehensive view across all our enterprise workspaces. Is there a best practice around unique account keys for how I store the data and login to Flask? user_id? workspace_id + user_id? or perhaps just the users email to keep it common?
Thank you for any and all help!
Warning: the env vars x & y were found, so we created an installation_store object for you, but that conflicts with token, so token was ignore. Please remove one of those vars if you want to use token.
This is a great suggestion! I will update the warning message for the case.
Finally a quick architecture question. If an app is added to multiple workspaces, does a single App() call to bolt register them all at once? And then a need to look at both team_id and user_id in the callbacks?
To handle multiple workspace installations, your
Appneeds to implement the installation flow: https://slack.dev/bolt-python/concepts#authenticating-oauth . In addition, yourAppusesinstallation_storefor determining a valid token in accordance with incoming request data (specifically, enterprise_id, team_id, user_id). In your listeners (or callbacks) like@app.actionetc, you don't need to do anything as long as theauthorizemiddleware that internally usesinstallation_storeworks properly. You can expect the token for workspace is set inclientargument. Also, a few other attributes are set incontextobject this way.Or instead does one startup a new process, one process per workspace?
No, you can handle requests from multiple workspaces with a single app.
Perfect, thanks again for the great info!
- added a commit that references this issue
on Mar 11, 2021
I'm writing a proof-of-concept bot/flask app called ExampleBot and internal tutorial for people inside our company to use to create their own internal apps. For now, these will not be published and will all use socket mode. We're all using Bolt and find it fantastic! Thank you for this great library and API.
While trying to figure out some good practices for allowing internal production vs. test instances, I noted that having both run at the same time connected to slack may be causing issues. (who knows what version is processing things)
One workaround could be to create the slack app all over again in a development slack workspace, then juggle the startup to handle different sets of configuration data. This seemed like a bit of extra manual work, so when I saw the "add to slack" workflow, I thought it might be an easy way to install it onto our development/test slack workspace. I implemented the flow, captured the results and store the new data by workspace id in a file (json dictionary dump)
BUT
I'm now getting this warning when my slack bot starts and it's no longer getting any events from slack:
As you gave
installation_store/authorizeas well,tokenwill be unused.I've spent most of today searching, writing additional code, and trying to either make this work or back it out to no avail. Any suggestions?
a) Is there an easy way to back this out? I removed the extra configs on app settings. Didn't work. Do I need to completely uninstall the app?
b) Or if I should move forward, any advice on how to get the app = App() call to succeed properly in this new case? Does the approach of using "add to slack" make any sense at all? Or did I open a huge gaping chasm of code needs that aren't appropriate in my case?
c) Any other suggestions on how to segregate production vs. test apps when only used internally?
Much thanks for any help!
Reproducible in:
Python 3.6.8
Linux vm 3.10.0-1160.15.2.el7.x86_64 #1 SMP Thu Jan 21 16:15:07 EST 2021 x86_64 x86_64 x86_64 GNU/Linux
The
slack_boltversionslack-bolt==1.4.1
slack-sdk==3.4.0