Functions-samples: Error sending webhook to slack

Created on 11 Mar 2017  Â·  6Comments  Â·  Source: firebase/functions-samples

Issue

• Following the Github to Slack example
• I am trying to send my own webhook request like this:

function postToSlack() {
  return rp({
        method: 'POST',
        uri: "https://hooks.slack.com/services/TEAM_ID/BOT_ID/API_KEY",
        body: { 
            channel: "#CHANNEL_NAME", 
            username: "webhookbot", 
            text: "MESSAGE"
        },
        json: true
    });
}

• I am getting this error

{
  "name": "RequestError",
  "message": "Error: getaddrinfo ENOTFOUND hooks.slack.com hooks.slack.com:443",
  "cause": {
    "code": "ENOTFOUND",
    "errno": "ENOTFOUND",
    "syscall": "getaddrinfo",
    "hostname": "hooks.slack.com",
    "host": "hooks.slack.com",
    "port": 443
  },
  "error": {
    "code": "ENOTFOUND",
    "errno": "ENOTFOUND",
    "syscall": "getaddrinfo",
    "hostname": "hooks.slack.com",
    "host": "hooks.slack.com",
    "port": 443
  }
}

• I tried to run the same function I am deploying in a my local node server and it works just fine

Most helpful comment

Are you on the free plan? The free plan cannot make external network requests. See more details here: https://firebase.google.com/pricing/ under bullet point 3

All 6 comments

Are you on the free plan? The free plan cannot make external network requests. See more details here: https://firebase.google.com/pricing/ under bullet point 3

@rockwotj can't seem to open the link?

Typo, I fixed the link. Try again

@rockwotj makes sense. Thanks!

Jut added a note about that in the README for this sample. Thanks for pointing this out :)

@nicolasgarnier no worries! that would save some people time debugging for sure!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Qzingo picture Qzingo  Â·  3Comments

inglesuniversal picture inglesuniversal  Â·  5Comments

rodrigosol picture rodrigosol  Â·  3Comments

rodrigoreal picture rodrigoreal  Â·  5Comments

kaceo picture kaceo  Â·  3Comments