Skip to content

User experience: Give a better error message when API key is missing #4

@vkumbha

Description

@vkumbha

Is your feature request related to a problem? Please describe.
Give a proper error message, when the API key is missing

CLI Version: Flowpipe v0.1.0

$ flowpipe pipeline run uptimerobot.pipeline.list_monitors
[flowpipe] Execution ID: exec_clujp7nljat7rfenbjv0
[list_monitors] Starting pipeline
[list_monitors.list_monitors] Starting http: POST https://api.uptimerobot.com/v2/getMonitors
[list_monitors.list_monitors] Complete: 200 667ms
[list_monitors] Internal Error: Error calculating output 'monitors': Internal Error: output: Unsupported attribute: This object does not have an attribute named "monitors".
(/Users/venu/turbie/turbot/flowpipe-mod-uptimerobot/pipelines/monitor/list_monitors.fp:30,56-65)
[list_monitors] Failed 678ms

Only after using a --verbose flag, we get to know

$ flowpipe pipeline run uptimerobot.pipeline.list_monitors --verbose
[flowpipe] Execution ID: exec_clujsrnljat7scnhik10
[list_monitors] Starting pipeline
[list_monitors.list_monitors] Starting http: POST https://api.uptimerobot.com/v2/getMonitors
[list_monitors.list_monitors] Arg method = POST
[list_monitors.list_monitors] Arg request_body = {"api_key":"","format":"json","logs":"1"}
[list_monitors.list_monitors] Arg request_headers = {
  "Cache-Control": "no-cache",
  "Content-Type": "application/json"
}
[list_monitors.list_monitors] Arg step_name = list_monitors
[list_monitors.list_monitors] Arg url = https://api.uptimerobot.com/v2/getMonitors
[list_monitors.list_monitors] Attr finished_at = 2023-12-16T06:06:38.617853Z
[list_monitors.list_monitors] Attr response_body = {
  "error": {
    "message": "api_key parameter is missing.",
    "parameter_name": "api_key",
    "type": "missing_parameter"
  },
  "stat": "fail"
}
[list_monitors.list_monitors] Attr response_headers = {
  "Alt-Svc": "h3=\":443\"; ma=86400",
  "Cf-Cache-Status": "DYNAMIC",
  "Cf-Ray": "8364bdd269ecf484-BOM",
  "Connection": "keep-alive",
  "Content-Security-Policy": "frame-ancestors 'self'",
  "Content-Type": "application/json; charset=utf-8",
  "Date": "Sat, 16 Dec 2023 06:06:38 GMT",
  "Etag": "W/\"79-ergfDZeyI1WuHJDomaLmz5TLbYo\"",
  "Nel": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}",
  "Permissions-Policy": "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()",
  "Referrer-Policy": "strict-origin-when-cross-origin",
  "Report-To": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=VfJ8AhBN4%2F5ElW0T6SnaC%2F09%2F%2FlkL%2FKd8ODUUiFzw1iPMLN53r2j99rlTGvyh3NUDLpvfnVUoI1KccJix4iAwpPQ0N9MzhDaS35xjd5KjbPt28ynOZnSIJoEuuJp8993fETbq6FgfBw2Pk1MAXQH4jk%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
  "Server": "cloudflare",
  "Strict-Transport-Security": "max-age=31536000; preload",
  "Vary": "Accept-Encoding",
  "X-Content-Type-Options": "nosniff",
  "X-Frame-Options": "SAMEORIGIN",
  "X-Xss-Protection": "1; mode=block"
}
[list_monitors.list_monitors] Attr started_at = 2023-12-16T06:06:38.346992Z
[list_monitors.list_monitors] Attr status = 200 OK
[list_monitors.list_monitors] Attr status_code = 200
[list_monitors.list_monitors] Complete: 200 272ms
[list_monitors] Internal Error: Error calculating output 'monitors': Internal Error: output: Unsupported attribute: This object does not have an attribute named "monitors".
(/Users/venu/turbie/turbot/flowpipe-mod-uptimerobot/pipelines/monitor/list_monitors.fp:30,56-65)
[list_monitors] Failed 280ms

The status code is 200 even for a failed request. Similar to slack api.
Perhaps include this message in the pipeline error instead of Error calculating output 'monitors'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststaleNo recent activity has been detected on this issue/PR and it will be closed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions