Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken example of how to open a modal in the documentation #875

Closed
5 of 15 tasks
Startouf opened this issue Sep 27, 2019 · 2 comments · Fixed by #880
Closed
5 of 15 tasks

Broken example of how to open a modal in the documentation #875

Startouf opened this issue Sep 27, 2019 · 2 comments · Fixed by #880

Comments

@Startouf
Copy link

Startouf commented Sep 27, 2019

Description

I tried following the examples given in the example documentation to open a modal, and it did not work and produced an error invalid_arguments

After digging a bit, the actual error explanation returned was

[ERROR] must define submit to use input block [json-pointer:/view/blocks/0/input]

It seems opening a modal via web.views.open(openModalPayload) requires the payload to have a submit field to work and will crash otherwise

This should be updated in the documentation (especially the "getting started" examples

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Packages:

Select all that apply:

  • @slack/web-api
  • @slack/events-api
  • @slack/interactive-messages
  • @slack/rtm-api
  • @slack/webhooks
  • I don't know

Reproducible in:

package version: @slack/web-api@^5.1.0", "@slack/web-api@^5.2.0"

node version: v11.5.0

Steps to reproduce:

  1. Start a nodejs app
  2. Follow the example given in the documentation to open a modal and copy the code to your own app
  3. Run the code up till this point

Expected result:

Expected the example to work

Actual result / Attachment

{ Error: An API error occurred: invalid_arguments
    at Object.platformErrorFromResult (/.../node_modules/@slack/web-api/src/errors.ts:94:5)
    at WebClient.apiCall (/.../node_modules/@slack/web-api/src/WebClient.ts:159:13)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
  code: 'slack_webapi_platform_error',
  data:
   { ok: false,
     error: 'invalid_arguments',
     response_metadata: { messages: [Array], scopes: [Array] } } }
{ messages:
   [ '[ERROR] must define `submit` to use `input` block [json-pointer:/view/blocks/0/input]' ],
shaydewael pushed a commit to shaydewael/node-slack-sdk that referenced this issue Oct 1, 2019
@shaydewael shaydewael mentioned this issue Oct 1, 2019
2 tasks
@shaydewael
Copy link
Contributor

Thanks for finding + pointing out the issue. I created a pull request to fix this 🙌

shaydewael pushed a commit that referenced this issue Oct 3, 2019
@erperejildo
Copy link

I get

An API error occurred: invalid_arguments
(node:637) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'view' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants