Code Monkey home page Code Monkey logo

Comments (8)

filmaj avatar filmaj commented on June 9, 2024

How are you configuring your App? What receiver are you using?

from bolt-js.

mcarrf90-bz avatar mcarrf90-bz commented on June 9, 2024

This is my App configuration:

const app = new App({
   signingSecret: process.env.SLACK_SIGNING_SECRET || '',   
   authorize,
  receiver,
  logger: {
    debug: (msg, ...args) => logger.debug(msg, ...args),
    info: (msg, ...args) => logger.info(msg, ...args),
    warn: (msg, ...args) => logger.warn(msg, ...args),
    error: (msg, ...args) => logger.error(msg, ...args),
    setLevel: (level) => logger.level = level,
    getLevel: () => logger.level as LogLevel, // Explicitly cast logger.level to LogLevel
    setName: (name) => { /* optional, implement if needed */ },
  },
  logLevel: process.env.LOGGER_LEVEL as LogLevel || 'info' as LogLevel,
});

Where authorize is the function on my original post. Here is my receiver:

const receiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET || '',   
   authorize,
});

from bolt-js.

filmaj avatar filmaj commented on June 9, 2024

What log level do you have set in production? Will you get WARN level events in your logs?

I ask because if your authorize function raises an exception, that should be visible in the logs (see the code here). I am wondering if that is what is happening in this situation (but we don't know because perhaps the log level is only set to ERROR).

If you're not seeing this warning, then that means the exception may not be coming from your authorize function but from somewhere else.

from bolt-js.

mcarrf90-bz avatar mcarrf90-bz commented on June 9, 2024

I have setup info on my log level for production. What I managed to realized locally is that the error is coming from the user_change event. It happens when there is not a matching authorization, the user_change event is being triggered anyway if this context is usefull. This is an example of a debug log I get:

{
  "token": "hGu1oUNhhu8oq3XFo5v773Pz",
  "team_id": "T0209NJETN0",
  "api_app_id": "A01KJ042JS3",
  "event": {
    "user": {
      "id": "U02EFD8C810",
      "team_id": "T02ECCVARLM",
      "name": "akhil",
      "color": "9f69e7",
      "is_bot": false,
      "is_app_user": false,
      "profile": {
        "avatar_hash": "5feac9543e5d",
        "image_original": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_original.jpg",
        "image_24": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_24.jpg",
        "image_32": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_32.jpg",
        "image_48": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_48.jpg",
        "image_72": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_72.jpg",
        "image_192": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_192.jpg",
        "image_512": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_512.jpg",
        "image_1024": "https://avatars.slack-edge.com/2022-10-20/4277252194432_5feac9543e5d6344db57_1024.jpg",
        "first_name": "Akhil",
        "last_name": "",
        "real_name": "Akhil",
        "display_name": "",
        "real_name_normalized": "Akhil",
        "display_name_normalized": "",
        "email": "[email protected]",
        "team": "T02ECCVARLM"
      },
      "updated": 1713452477,
      "who_can_share_contact_card": "EVERYONE"
    },
    "cache_ts": 1713452477,
    "type": "user_change",
    "event_ts": "1713452501.284700"
  },
  "type": "event_callback",
  "event_id": "Ev0707SUEK7S",
  "event_time": 1713452501,
  "authorizations": [
    {
      "enterprise_id": null,
      "team_id": "T0209NJETN0",
      "user_id": "U056B2Q37R8",
      "is_bot": true,
      "is_enterprise_install": false
    }
  ],
  "is_ext_shared_channel": false
}

from bolt-js.

filmaj avatar filmaj commented on June 9, 2024

Can you set log level to DEBUG to help us figure out where the error is coming from?

from bolt-js.

filmaj avatar filmaj commented on June 9, 2024

I'm also confused: if your authorize function is raising an exception when the user_change event comes in, I would expect that to create a WARN log in your logs (as per this line). If that's not happening, then that means your authorize function is NOT raising an exception in this situation.

from bolt-js.

github-actions avatar github-actions commented on June 9, 2024

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

from bolt-js.

github-actions avatar github-actions commented on June 9, 2024

As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number.

from bolt-js.

Related Issues (20)

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.