slackapi / deno-slack-sdk

SDK for building Run on Slack apps using Deno
https://api.slack.com/automation
MIT License
158 stars 27 forks source link

Deno Permission Denied Error When Writing to File via Slack Input Form #350

Open InesKouki opened 1 month ago

InesKouki commented 1 month ago

Hello ! I am working on a Slack-Deno application. My project involves a function that handles documentation onboarding. This function reads the input from a Slack form, writes to a CSV file, and also triggers a PowerShell script. However, I am encountering a PermissionDenied error when trying to write to the CSV file.

Screenshot 2024-08-05 at 14 31 25 Could someone help me with this please ? Screenshot 2024-08-05 at 13 44 00

This is my manifest file

export default Manifest({
  name: "client-onboarding-app",
  description: "A Slack app to onboard clients",
  icon: "assets/default_new_app_icon.png",
  workflows: [OnboardingWorkflow],
  functions: [HandleDocumentationOnboardingDefinition],
  outgoingDomains: [],
  botScopes: ["commands", "chat:write", "chat:write.public", "files:write"],
});

And this is my slack.json

{
  "hooks": {
    "get-hooks": "deno run -q --allow-read --allow-net https://deno.land/x/deno_slack_hooks@1.2.3/mod.ts"
  }
}
hello-ashleyintech commented 1 month ago

Hi, @InesKouki! Thanks for submitting your question 😄

Based on the PermissionDenied error, it seems like write permissions haven't been granted to the system for your CSV file. I would recommend adding the --allow-write flag within your slack.json - you can reference the deno-slack-hooks repo here for more info!

hello-ashleyintech commented 1 month ago

@InesKouki I also just received word from the team that the --allow-write flag will only work for slack run, but if you slack deploy your app to Slack infra, that will not support file writing and will fail with the same error!