Giter VIP home page Giter VIP logo

slack-ruby-bot-server-events-sample's People

Contributors

dblock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

slack-ruby-bot-server-events-sample's Issues

Unable to return a formatted modal using a slash command event

I've been trying to follow along with the Slack API docs to get a slash command to return a modal.

It appears to be a successful response but Slack returns it as raw output rather than as a modal:
image

I've not had much luck debugging this unfortunately. The content-type appears to be correct, so I'm wondering if it's something to do with the url and that if I need to specify views.open somewhere?

Any insight on this would be really appreciated!

This is a copy of the command I'm trying to send:

SlackRubyBotServer::Events.configure do |config|
  config.on :command, '/testing' do |command|
    command.logger.info 'Received a test.'

    {
    "trigger_id": command[:trigger_id],
    "view": {
      "type": "modal",
      "callback_id": "modal-identifier",
      "title": {
        "type": "plain_text",
        "text": "Modal Title"
      },
      "submit": {
        "type": "plain_text",
        "text": "Submit"
      },
      "blocks": [
        {
          "type": "input",
          "element": {
            "type": "plain_text_input",
            "action_id": "title",
            "placeholder": {
              "type": "plain_text",
              "text": "What do you want to ask of the world?"
            }
          },
          "label": {
            "type": "plain_text",
            "text": "Title"
          }
        },
        {
          "type": "input",
          "element": {
            "type": "multi_channels_select",
            "action_id": "channels",
            "placeholder": {
              "type": "plain_text",
              "text": "Where should the poll be sent?"
            }
          },
          "label": {
            "type": "plain_text",
            "text": "Channel(s)"
          }
        },
        {
          "type": "input",
          "element": {
            "type": "plain_text_input",
            "action_id": "option_1",
            "placeholder": {
              "type": "plain_text",
              "text": "First option"
            }
          },
          "label": {
            "type": "plain_text",
            "text": "Option 1"
          }
        },
        {
          "type": "input",
          "element": {
            "type": "plain_text_input",
            "action_id": "option_2",
            "placeholder": {
              "type": "plain_text",
              "text": "How many options do they need, really?"
            }
          },
          "label": {
            "type": "plain_text",
            "text": "Option 2"
          }
        },
        {
          "type": "actions",
          "elements": [
            {
              "type": "button",
              "action_id": "add_option",
              "text": {
                "type": "plain_text",
                "text": "Add another option  "
              }
            }
          ]
        }
      ]
    }
  }
  end
end

Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2)

When running foreman start I get the following error stack trace:

09:29:59 web.1  | started with pid 34597
09:30:00 web.1  | Puma starting in single mode...
09:30:00 web.1  | * Puma version: 5.6.4 (ruby 3.0.0-p0) ("Birdie's Version")
09:30:00 web.1  | *  Min threads: 0
09:30:00 web.1  | *  Max threads: 5
09:30:00 web.1  | *  Environment: development
09:30:00 web.1  | *          PID: 34597
09:30:35 web.1  | W, [2022-05-26T09:30:02.904788 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:03.907261 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:04.909189 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:05.910196 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:06.911338 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:07.910864 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:08.911643 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:09.912407 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:10.913419 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:11.915141 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:12.916599 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:13.917654 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:14.918637 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:15.920178 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:16.921682 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:17.923136 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:18.924406 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:19.925901 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:20.927436 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:21.928206 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:22.929767 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:23.931036 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:24.932464 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:25.933702 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:26.934407 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:27.935726 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:28.935228 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:29.937025 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:30.936996 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:31.939267 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:32.940447 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:33.909469 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:34.911084 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:30:35 web.1  | W, [2022-05-26T09:30:35.911434 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | Error connecting to MongoDB: No primary server is available in cluster: #<Cluster topology=Unknown[127.0.0.1:27017] servers=[#<Server address=127.0.0.1:27017 UNKNOWN>]> with timeout=30, LT=0.015
09:31:03 web.1  | W, [2022-05-26T09:30:36.912636 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:37.914156 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:38.915677 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:39.916400 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:40.917139 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:41.919447 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:42.919412 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:43.921327 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:44.922785 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:45.922562 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:46.923599 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:47.924350 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:48.925679 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:49.927071 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:50.927101 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:51.928033 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:52.927979 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:53.929547 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:54.930273 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:55.930972 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:56.930708 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:57.931828 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:58.933072 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:30:59.935143 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:31:00.936003 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:31:01.935893 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | W, [2022-05-26T09:31:02.935886 #34597]  WARN -- : MONGODB | Error checking 127.0.0.1:27017: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27017 (for 127.0.0.1:27017 (no TLS)) (on 127.0.0.1:27017)
09:31:03 web.1  | ! Unable to load application: Mongo::Error::NoServerAvailable: No primary server is available in cluster: #<Cluster topology=Unknown[127.0.0.1:27017] servers=[#<Server address=127.0.0.1:27017 UNKNOWN>]> with timeout=30, LT=0.015
09:31:03 web.1  | bundler: failed to load command: puma (/Users/stevenaguilar/.rvm/gems/ruby-3.0.0/bin/puma)
09:31:03 web.1  | /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/mongo-2.17.1/lib/mongo/server_selector/base.rb:285:in `select_server': No primary server is available in cluster: #<Cluster topology=Unknown[127.0.0.1:27017] servers=[#<Server address=127.0.0.1:27017 UNKNOWN>]> with timeout=30, LT=0.015 (Mongo::Error::NoServerAvailable)
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/mongo-2.17.1/lib/mongo/database.rb:220:in `block in command'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/mongo-2.17.1/lib/mongo/client.rb:1067:in `with_session'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/mongo-2.17.1/lib/mongo/database.rb:219:in `command'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/forwardable.rb:238:in `command'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/slack-ruby-bot-server-1.2.1/lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb:9:in `check!'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/slack-ruby-bot-server-1.2.1/lib/slack-ruby-bot-server/app.rb:18:in `check_database!'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/slack-ruby-bot-server-1.2.1/lib/slack-ruby-bot-server/app.rb:6:in `prepare!'
09:31:03 web.1  | 	from config.ru:7:in `block in <main>'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/lib/puma/configuration.rb:348:in `load_rackup'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/lib/puma/configuration.rb:270:in `app'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/lib/puma/runner.rb:150:in `load_and_bind'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/lib/puma/single.rb:44:in `run'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/lib/puma/launcher.rb:182:in `run'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/lib/puma/cli.rb:81:in `run'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/puma-5.6.4/bin/puma:10:in `<top (required)>'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/bin/puma:23:in `load'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/bin/puma:23:in `<top (required)>'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/cli/exec.rb:58:in `load'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/cli/exec.rb:58:in `kernel_load'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/cli/exec.rb:23:in `run'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/cli.rb:478:in `exec'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/cli.rb:31:in `dispatch'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/cli.rb:25:in `start'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/exe/bundle:49:in `block in <top (required)>'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/gems/bundler-2.2.31/exe/bundle:37:in `<top (required)>'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/bin/bundle:23:in `load'
09:31:03 web.1  | 	from /Users/stevenaguilar/.rvm/gems/ruby-3.0.0/bin/bundle:23:in `<main>'
09:31:03 web.1  | exited with code 1
09:31:03 system | sending SIGTERM to all processes

I wonder if there is some setup missing in the documentation for MongoDB? If so I am happy to create a PR to update the docs with such information. Or maybe this is something that is on my end

Setting up a Message Shortcut action - Routing error - No route matches [POST] "/slack/interaction"

Hi,

Thank you for designing this library. I would need some help to set up a message shortcut action.

I am trying to use a message shortcut. Its ID on my Slack app settings is desk_message_shortcut.
I have informed the Interactive Components Request URL with my ngrok Request URL.

I am storing the code for Slack API in the following repository: myrailsapp/app/lib/slack
I am storing the file for the response to the message shortcut here: myrailsapp/app/lib/slack/actions
I basically copied paste the code for the count_letters shortcut, in order to only test the shortcut connection at first:

SlackRubyBotServer::Events.configure do |config|
    config.on :action, 'message_action', 'desk_message_shortcut' do |action|
      payload = action[:payload]
      message = payload[:message]
      # action.logger.info "Counting letters in \"#{message[:text]}\"."
      Rails.logger.info("Inside of the shortcut message code")
      # byebug
      { ok: true }
    end
  end  

When trying to click the message shortcut from Slack GUI, I get a connection error on Slack end.
In myrailsapp logs, I get the following error message:

Started POST "/slack/interaction" for .. at 2023-03-14 13:37:58 +0000
Cannot render console from ... Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
ActionController::RoutingError (No route matches [POST] "/slack/interaction"):

What setting am I missing here?

Thank you,

Isabelle

How to customize Team model?

I wanted to customize Team model and also add some other models to the app.
What would be the correct approach?
Thank you!

Error running Events spec

I have written an events spec in my project, similar to the ones in this projects, and when I run it I get the following error

Failure/Error: Team.create!(team)

     NoMethodError:
       undefined method `empty?' for #<Team _id: 65847bcb7fc2383892cb5523, created_at: 2023-12-21 17:54:19.206309 UTC, updated_at: 2023-12-21 17:54:19.206309 UTC, team_id: "T0", name: "minus", domain: nil, token: "abc-0", oauth_scope: nil, oauth_version: "v1", active: true, bot_user_id: nil, activated_user_id: nil, activated_user_access_token: nil>
# /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/attributes/processing.rb:20:in `process_attributes'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/document.rb:233:in `block in construct_document'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/threaded/lifecycle.rb:80:in `_building'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/document.rb:228:in `construct_document'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/document.rb:104:in `initialize'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/persistable/creatable.rb:172:in `new'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/persistable/creatable.rb:172:in `block in create!'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/threaded/lifecycle.rb:142:in `_creating'
     # /Users/domster83/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mongoid-8.1.4/lib/mongoid/persistable/creatable.rb:168:in `create!'
     # ./spec/events/events_link_shared_spec.rb:51:in `block (4 levels) in <main>'

And my spec

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'events/link_shared' do
  include Rack::Test::Methods

  def app
    SlackRubyBotServer::Api::Middleware.instance
  end

  context 'without signature checks' do
    before do
      allow_any_instance_of(Slack::Events::Request).to receive(:verify!)
    end

    let!(:team) { Fabricate(:team) }

    let(:event) do
      {
        token: SecureRandom.hex,
        team_id: 'team_id',
        api_app_id: 'AAAA',
        event: {
          type: 'link_shared',
          user: 'user_id',
          channel: 'C1',
          message_ts: '1547842100.001400',
          links: [{
            url: "https://example.com",
            domain: 'example.com
          }]
        },
        type: 'event_callback',
        event_id: 'EvFGTNRKLG',
        event_time: 1_547_842_101,
        authed_users: ['AAAA']
      }
    end

    let(:user) do
      { user: { name: 'Bob' } }
    end

    let(:channel) do
      { channel: { name: 'random' } }
    end

    context 'with a named event handler' do
      before do
        Team.create!(team)
      end

      it 'posts System Data blocks' do
        system_blocks = get_blocks(event[:event][:links][0][:url])
        # expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with(
        #   channel: 'channel_id', text: 'Welcome Bob to random!'
        # )
        post '/api/slack/event', event
        expect(last_response.status).to eq 201
        expect(JSON.parse(last_response.body)).to eq(system_blocks.to_slack_blocks.to_json)
      end
    end
  end
end

Any help appreciated

Grape::Exceptions::ValidationErrors: type is missing

Thanks for your patience. I'm trying to use this project with Ruby version 3.0.1-p64. When running foreman start I get the following error:

stevenaguilar ~/slack-ruby-bot-server-events-sample on master[!]
$ foreman start
07:47:08 web.1  | started with pid 6695
07:47:09 web.1  | Puma starting in single mode...
07:47:09 web.1  | * Puma version: 5.6.4 (ruby 3.0.1-p64) ("Birdie's Version")
07:47:09 web.1  | *  Min threads: 0
07:47:09 web.1  | *  Max threads: 5
07:47:09 web.1  | *  Environment: development
07:47:09 web.1  | *          PID: 6695
07:47:12 web.1  | * Listening on http://0.0.0.0:5000
07:47:12 web.1  | Use Ctrl-C to stop
07:52:04 web.1  | I, [2022-06-02T07:52:04.277423 #6695]  INFO -- : Starting team name=BigShort, id=TSFN24QMA.
08:15:07 web.1  | W, [2022-06-02T08:15:07.836780 #6695]  WARN -- : Grape::Exceptions::ValidationErrors: type is missing
08:15:07 web.1  |   /Users/stevenaguilar/.rvm/gems/ruby-3.0.1/gems/grape-1.6.2/lib/grape/endpoint.rb:365:in `run_validators'
08:15:07 web.1  |   /Users/stevenaguilar/.rvm/gems/ruby-3.0.1/gems/grape-1.6.2/lib/grape/endpoint.rb:259:in `block in run'
08:15:07 web.1  |   /Users/stevenaguilar/.rvm/gems/ruby-3.0.1/gems/activesupport-7.0.3/lib/active_support/notifications.rb:208:in `instrument'
08:15:07 web.1  |   /Users/stevenaguilar/.rvm/gems/ruby-3.0.1/gems/grape-1.6.2/lib/grape/endpoint.rb:241:in `run'
08:15:07 web.1  |   /Users/stevenaguilar/.rvm/gems/ruby-3.0.1/gems/grape-1.6.2/lib/grape/endpoint.rb:316:in `block in build_stack'
08:15:07 web.1  |   /Users/stevenaguilar/.rvm/gems/ruby-3.0.1/gems/newrelic_rpm-8.7.0/lib/new_relic/agent/instrumentation/middleware_tracing.rb:100:in `call'

From the stack trace I notice that the version is grape-1.6.2 Since this is a newly version I took a look into the gem and noticed that there are some Upgrading Grape guidelines. It seems from the upgrading documentation that the type has to be declared as shown in the code snippet below:

params do
  requires :id, type: Integer
  group :name do
    requires :first_name
    requires :last_name
  end
end

However, I'm unable to track where is this being raised in the codebase for the sample app. It seems the stack trace points to the following line https://github.com/ruby-grape/grape/blob/master/lib/grape/endpoint.rb#L365 but I can't seem to find were the arguments for that method call are being passed in this codebase.

Im new to this gem, would love some sort of guidance as to where is grape being used and where could this error be raised from.
Any bit of guidance is appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.