question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails to spin up a Bolt app due to a proxy connection issue

See original GitHub issue

While attempting to follow the instructions mentioned on getting started with bolt guide, I got /hello failed with the error “operation_timeout” error.

It is similar to issue #485, and the recommendation was to use only SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET tokens. However, if I don’t provide clientId and clientSecret additionally, the SlackAppServer won’t start ([main] INFO com.slack.api.bolt.jetty.SlackAppServer - ⚡️ Bolt app is running!). But providing clientId/clientSecret in turn needs Oauth handling.

The behavior is same irrespective of using environment variables or AppConfig approach. Also if I run the app without any token configuration (either via AppConfig or environment variables), the server is starting okay but request url verification fails and slack command fails with the dispatch error (/hello failed with the error "dispatch_failed").

Reproducible in:

The Slack SDK version

com.slack.api:bolt-jetty:1.18.0

Java Runtime version

java version “1.8.0_171” Java™ SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot™ 64-Bit Server VM (build 25.171-b11, mixed mode)

OS info

Oracle Linux 7 (4.1.12-124.49.3.1.el7uek.x86_64)

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., pom.xml/build.gradle))

1.Install the app with a /hello slash command handler 2. Serve MyApp with the code you proposed in your example (replacing your example slash command name with “/hello”) 3.Use ngrok to expose local environment to Slack app 4.Configure Slack app to use ngrok URL 5.Run app with env vars for the creds specified in the Slack app’s admin pages

Expected result:

SlackAppServer is running and can perform request-url verification and slack command operations.

Sample output when clientId, clientSecret, bot-token and signing keys are provided :

[main] INFO org.eclipse.jetty.util.log - Logging initialized @1666ms to org.eclipse.jetty.util.log.Slf4jLog
[main] INFO org.eclipse.jetty.server.Server - jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 1.8.0_171-b11
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@29176cc1{/,null,AVAILABLE}
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@6c3f5566{HTTP/1.1, (http/1.1)}{0.0.0.0:8000}
[main] INFO org.eclipse.jetty.server.Server - Started @1895ms
[main] INFO com.slack.api.bolt.jetty.SlackAppServer - ⚡️ Bolt app is running!

Sample output when no tokens are configured :

[main] INFO org.eclipse.jetty.util.log - Logging initialized @1211ms to org.eclipse.jetty.util.log.Slf4jLog
[main] WARN com.slack.api.bolt.App - Skipped adding any authorization middleware - you need to call `app.use(new YourOwnMultiTeamsAuthorization())`
[main] INFO org.eclipse.jetty.server.Server - jetty-9.4.44.v20210927; built: 2021-09-27T23:02:44.612Z; git: 8da83308eeca865e495e53ef315a249d63ba9332; jvm 1.8.0_171-b11
[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@2928854b{/,null,AVAILABLE}
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@6c3f5566{HTTP/1.1, (http/1.1)}{0.0.0.0:8000}
[main] INFO org.eclipse.jetty.server.Server - Started @1440ms
[main] INFO com.slack.api.bolt.jetty.SlackAppServer - ⚡️ Bolt app is running!

Actual result:

Nothing gets logged after

[main] INFO org.eclipse.jetty.util.log - Logging initialized @1672ms to org.eclipse.jetty.util.log.Slf4jLog

Couldn’t perform request url verification or slash command handling.

Requirements

Please make sure if this topic is specific to this SDK. For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to the those rules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
WorkingAngelcommented, Nov 1, 2022

@seratch I faced similar issue as this post, I already setup my proxy server, but it still failed with network unreachable issue.

[main] INFO org.eclipse.jetty.util.log - Logging initialized @537ms to org.eclipse.jetty.util.log.Slf4jLog [java.net.SocketException: Network is unreachable (connect failed), java.net.SocketException: Network is unreachable (connect failed)] [main] ERROR com.slack.api.methods.impl.TeamIdCache - Failed to call auth.test API (error: Network is unreachable (connect failed))

here is my snipped code of server start, may I know how can I setup in code to solve this issue?

    AppConfig conf = new AppConfig();
    conf.setSigningSecret(SLACK_SIGNING_SECRET);
    conf.setSingleTeamBotToken(SLACK_BOT_TOKEN);

    conf.getSlack().getConfig().setProxyUrl(System.getenv("http_proxy"));

    System.out.println(conf.getSlack().getConfig().getProxyUrl());
    System.out.println(conf.getSigningSecret());
    System.out.println(conf.getSingleTeamBotToken());

    App app = new App(conf);

    app.command("/hello", (req, ctx) -> {
        return ctx.ack(":wave: Hello!");
    });

    SlackAppServer server = new SlackAppServer(app, 8888);
    server.start(); // http://localhost:3000/slack/events
0reactions
seratchcommented, Feb 18, 2022

I’m sure that we’ve provided an answer to your question here. Let us close this issue now but, if you have any follow ups, please feel free to write in!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Unable to Connect to the Proxy Server | VSS Guide
1. Confirm if your VPN client is Responsible- if you have one installed on your PC · 2. Check if the Settings in...
Read more >
Bolt Basics | Slack SDK for Java
Bolt for Java is a framework on the JVM that offers an abstraction layer to build Slack apps ... This guide covers all...
Read more >
Proxy error while accessing the application - java
As a first thing resolve all DB connectivity issues and test your application by directly connecting to custom web server (not via proxy)....
Read more >
While trying to download and install an app, error proxy server
Check your proxy settings 127.0.0.1:57720. Go to Tools > Internet Options > Connections. If you are on a LAN, click “LAN settings”.
Read more >
What an HTTP Error 429 Means & How to Fix It - HubSpot Blog
HTTP Error 429 is an HTTP response status code that indicates the client application has surpassed its rate limit, or number of requests...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found