Open zcin opened 4 months ago
Hey @zcin! 👋 Deno requires explicit permission to access external resources, which is exactly what you're seeing with the "missing network permissions". The --allow-net
flag is often the answer to this, but the CLI and SDK work together to configure this on startup automatically.
To make HTTP requests to external domains, you'll have to add the domain to your app manifest as an outgoing domain:
export default Manifest({
name: "example-app",
outgoingDomains: [
"localhost",
],
});
This should update permissions so that requests can be made to localhost:8000
, but please let me know if something still isn't working.
Also want to callout that I believe localhost
will only work in a local run context since apps deployed to Slack infrastructure don't have a localhost:8000
. No worries if this isn't a problem, but a public endpoint is needed otherwise or this error will appear:
Localhost is only a valid outgoing domain for local apps. (domain_blocked)
The
deno-slack
versionsDeno runtime version
deno 1.42.4 (release, aarch64-apple-darwin) v8 12.3.219.9 typescript 5.4.3
OS info
Steps to reproduce
I want to send an HTTP request inside my custom function invoked in my app workflow. I am running the following code:
My
slack.json
:Expected result
I expect the HTTP request to be sent successfully, since I added
allow-net
inslack.json
. However I'm not sure if I added it correctly, or where is the correct place to add--allow-net
.Actual result