Giter VIP home page Giter VIP logo

deno-simple-survey's People

Contributors

cchensh avatar filmaj avatar github-actions[bot] avatar hello-ashleyintech avatar jesselawson avatar misscoded avatar srajiang avatar vegeris avatar williambergamin avatar zimeg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deno-simple-survey's Issues

When submitting a survey result, the OpenForm step incorrectly states Comments are optional

If you submit a survey result with no comment, when running locally, you will see this error in your terminal:

2023-03-31 17:46:22 [error] [Wf051B1J9MA7] (Trace=Tr051DRY3HN0) Execution failed for workflow 'Respond to a survey'
	parameter_validation_failed - Null value for non-nullable parameter `comments`

If you submit a survey result with a comment, things work as expected.

Easy workaround is to set the Comment field in the survey result submission OpenForm step to required.

Incorrect defaulting for optional output

In workflows/answer_survey.ts, there's an attempt to provide a default value for a non-required output from step 1, response.outputs.fields.comments:

// Step 2: Append responses to the spreadsheet
AnswerSurveyWorkflow.addStep(SaveResponseFunctionDefinition, {
  reactor_access_token_id: AnswerSurveyWorkflow.inputs.reactor_access_token_id,
  google_spreadsheet_id: AnswerSurveyWorkflow.inputs.google_spreadsheet_id,
  impression: response.outputs.fields.impression,
  comments: response.outputs.fields.comments || "",
});

However, response.outputs.fields.comments isn't a literal string but rather the output to a call to ParamReference from deno-slack-sdk/src/parameters/param.ts:

// deno-lint-ignore no-explicit-any
export const ParamReference = (...path: (string | undefined)[]): any => {
  const fullPath = path.filter(Boolean).join(".");

  return {
    toString: () => `{{${fullPath}}}`,
    toJSON: () => `{{${fullPath}}}`,
  };
};

As a non-empty object, it will never be falsy, so the || "" is ineffectual, and it is always passed as the value of comments, even when it doesn't have a value, resulting in runtime errors:

image

2023-08-04 14:17:56 [info] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Trigger for workflow '%!!(MISSING)s(<nil>)' started: 
2023-08-04 14:17:56 [info] [Fn05LXTA55CG] (Trace=Tr05L9LC9NSH) Function 'Respond to a survey' (workflow function) started
2023-08-04 14:17:56 [info] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Workflow 'Respond to a survey' started
2023-08-04 14:17:56 [info] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Workflow step 1 of 2 started
2023-08-04 14:17:56 [info] [Fn010N] (Trace=Tr05L9LC9NSH) Function 'Collect info in a form' (Slack function) started
2023-08-04 14:18:00 [info] [Fn010N] (Trace=Tr05L9LC9NSH) Function 'Collect info in a form' (Slack function) completed
2023-08-04 14:18:01 [info] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Workflow step 'Collect info in a form' completed
2023-08-04 14:18:01 [error] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Workflow step 2 of 2 started
2023-08-04 14:18:01 [error] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Workflow 'Respond to a survey' failed
        parameter_validation_failed - Null value for non-nullable parameter `comments`
2023-08-04 14:18:01 [error] [Wf05LXTA58F2] (Trace=Tr05L9LC9NSH) Workflow 'Respond to a survey' failed
        parameter_validation_failed - Null value for non-nullable parameter `comments`
2023-08-04 14:18:02 [error] [Fn05LXTA55CG] (Trace=Tr05L9LC9NSH) Function 'Respond to a survey' (%!!(MISSING)s(<nil>) function) failed
        parameter_validation_failed - Null value for non-nullable parameter `comments`

I'm still a beginner, so I don't know what the proper way to provide a default value is when piping workflow steps together, but this isn't it.

Add tests for custom functions

To ensure stable logic and proper error handling in custom functions, tests should be added with mocks of API endpoints.

These tests should cover the happy path and ensure APIs are called with the correct data the appropriate number of times (for example, conversations.join should be called for each listed channel in the maintain_membership.ts function). Error handling should also be tested, particularly for external auth related functionality.

After adding tests, a section on testing should be added to the README.

Manifest validation fails

When running slack manifest validate, an error is returned. This prevents the app from running locally or being deployed.

โžœ hermes manifest validate
? Select a workspace filboxworkspace T029V6468RL
? Choose an app environment Local A051PPKF52M
Check /Users/fmaj/.slack/logs/slack-debug-20230410.log for full error logs

๐Ÿšซ The provided manifest file does not validate against schema. Consult the additional errors field to locate specific issues (invalid_manifest)

Error Details:

1: Workflow function `create_survey` step `0` param `google_access_token_id` contains an invalid value (invalid_template_values_wf_function_step)
Source: /workflows/create_survey/steps/0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.