500 ISE when creating hook with 0 for day-of-month in the schedule

RESOLVED FIXED

Status

Taskcluster
Hooks
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: amiyaguchi, Assigned: amiyaguchi)

Tracking

Details

(Assignee)

Description

2 years ago
I am attempting to create a new hook. I have obtained the scopes for `auth:create-role:hook-id:garbage/*` and with it created a new role with the appropriate scopes.

> role: hook-id:garbage/amiyaguchi
> scope: assume:moz-tree:level:1

I then created a hook with the following properties.

> groupHookId: garbage
> hookId: amiyaguchi

I get a 500 server error, with the logs below. I should be able to create the hook with the current role that I have created and the scopes that I have obtained.
   
> Error:Internal Server Error,
> incidentId:8343b977-b4a4-4ffc-a7fa-1a2d2e832061 ---- 
> errorCode:InternalServerError statusCode:500
> requestInfo:method:createHook
> params:{
>    "hookGroupId":"garbage",
>    "hookId":"amiyaguchi"
> }payload:{
>    "metadata":{
>       "name":"test",
>       "description":"test hook for garbage scopes amiyaguchi",
>       "owner":"amiyaguchi@mozilla.com",
>       "emailOnError":true
>    },
>    "schedule":[
>       "0 0 0 0 0 *"
>    ],
>    "expires":"3 months",
>    "deadline":"6 hours",
>    "task":{
>       "provisionerId":"aws-provisioner-v1",
>       "workerType":"tutorial",
>       "payload":{
>          "image":"ubuntu:14.04",
>          "command":[
>             "/bin/bash",
>             "-c",
>             "echo \"hello World\""
>          ],
>          "maxRunTime":600
>       },
>       "metadata":{
>          "name":"Hook Task",
>          "description":"Task Description",
>          "owner":"name@example.com",
>          "source":"https://tools.taskcluster.net/hooks/"
>       },
>       "schedulerId":"-",
>       "routes":[],
>       "priority":"normal",
>       "retries":5,
>       "scopes":[],
>       "tags":{},
>       "extra":{}
>    }
> }
> time:2016-07-06T21:00:28.568Z details:{
>    "incidentId":"8343b977-b4a4-4ffc-a7fa-1a2d2e832061"
> }
I think the problem -- which we should surface better -- is that you've specified that the hook should run on the 0th of the month.  The error I see in Sentry (that caused the 500) is "Error: Constraint error, got value 0 expected range 1-31" which isn't a whole lot more useful, is it :(

So the workaround should be clear, but we'll need to fix this somehow, too.
Summary: Unable to create new hook with garbage scopes → 500 ISE when creating hook with 0 for day-of-month in the schedule
(Assignee)

Comment 3

2 years ago
It's very useful information in this case, I've managed to successfully create a hook now. It was just me writing invalid scheduling syntax, but it was difficult to pinpoint what I was doing wrong. It would be nice to have the input validated on the client for more direct feedback. Surfacing the errors also might be helpful with debugging the hooks service.
(Assignee)

Updated

2 years ago
No longer blocks: 1252948
(Assignee)

Updated

2 years ago
Assignee: nobody → amiyaguchi
Merged -- nicely done, thanks!
(Assignee)

Comment 5

2 years ago
Hooks will now propagate the errors to the user and return a 400 bad request. Clients should still validate their inputs, but at least the server will complain more verbosely.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.