doowb / slack-invite-webtask

Webtask.io service to invite users to a slack team.
MIT License
5 stars 2 forks source link

Keep getting "error":"Invalid email address" #1

Open jonasrosland opened 7 years ago

jonasrosland commented 7 years ago

Hi,

I've tried this out by following your steps using webtask.io, and I keep getting the following error:

{"ok":false,"error":"Invalid email address"}

Steps I used:

  1. wt create dist/main.js --name my-slack-invite-name --secret SLACK_TEAM='mygroup' --secret SLACK_TOKEN='xoxp-my-secret-token'
  2. I get the webtask and add it to a standard HTML file using your guide:
    <form method="POST" action="https://my-webtask-id.run.webtask.io/my-slack-invite-name?webtask_no_cache=1">
    <div>Email</div>
    <div><input type="text" name="email"></div>
    <div><input type="submit" value="Send"></div>
    </form>
  3. I open the HTML file, enter a valid email jonas.rosland@gmail.com, and get the error above.

What am I doing wrong? Do I need to install the NPM package locally as well?

doowb commented 7 years ago

Thanks for bringing this up. I think webtask changed some of the defaults they use when creating the webtask.

Add the --parse-body option to the wt create command and see if that works for you. This will tell the webtask to parse the request body into a JSON object and put it on ctx.data. This used to be done automatically in some cases.

If this works, I'll update the docs (since I don't think there's anything I can do in the code to enable this flag).

cyrus-za commented 7 years ago

Hi, I know this issue is like months old but @doowb your solution above worked for me. Please update the readme :) 👍

doowb commented 7 years ago

Thanks, I'll get the readme updated.