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

Matrix Webhook fails - attempt displays epoch as date #14010

Closed
2 of 6 tasks
ryexandrite opened this issue Dec 16, 2020 · 2 comments · Fixed by #14148
Closed
2 of 6 tasks

Matrix Webhook fails - attempt displays epoch as date #14010

ryexandrite opened this issue Dec 16, 2020 · 2 comments · Fixed by #14148
Assignees
Labels

Comments

@ryexandrite
Copy link

  • Gitea version (or commit ref): 1.14.0+dev-388-gb8c58edf3
  • Git version: 2.26.2
  • Operating system: running in docker on debian
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
2020/12/16 04:04:59 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] INSERT INTO "hook_task" 
("repo_id","hook_id","uuid","typ","url","signature","payload_content","http_method","content_type","event_type","is_ssl","is_delivered","delivered","is_succeed","request_content","response_content") VALUES 
($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) RETURNING "id" [18 11 fe619173-2390-4bbb-b368-229eb5c161b2 matrix           https://***/_matrix/client/r0/rooms/***/send/m.room.message  {     
 "body": "***",
"msgtype": "m.notice",                                                                                                                                                                                           "format": "org.matrix.custom.html",   
"formatted_body": "***",   
"io.gitea.commits": [ 
{  
"id": "e642fcb81be5da12ad7bd04a771d7ab254ce513b", 
"message": "main: any origin", 
"url": "https://git.***/commit/e642fcb81be5da12ad7bd04a771d7ab254ce513b",                                                                                                  "author": {                                                                                                                                                                                                        "name": "***",                                                                                                                                                                                                "email": "****",                                                                                                                                                                                "username": ""                                                                                                                                                                                                 },                                                                                                                                                                                                               "committer": {                                                                                                                                                                                                     "name": "***",                                                                                                                                                                                                "email": "***",                                                                                                                                                                                "username": ""                                                                                                                                                                                                 },    
"verification": null,    
"timestamp": "0001-01-01T00:00:00Z",
"added": null,   
"removed": null,    
"modified": null
            }  
],                                                                                                                                                                                                               "access_token": "*****"   
 } PUT 1 push false false 0 false  ] - 13.554059ms   
2020/12/16 04:04:59 ...outers/routes/chi.go:95:1() [I] Completed POST /***/settings/hooks/11/test 0  in 58.843203ms
2020/12/16 04:04:59 ...m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT "id", "repo_id", "hook_id", "uuid", "typ", "url", "signature", "payload_content", "http_method", "content_type", "event_type", "is_ssl", "is_delivered", "delivered", "is_succeed", "request_content", "response_content" FROM "hook_task" WHERE (repo_id=$1 AND is_delivered=$2) [18 false] - 762.601µs  
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2419] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2420] PUT 
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2425] PUT 
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2427] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2429] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2431] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2433] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2435] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2437] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2439] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2441] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2443] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2445] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2447] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2449] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2451] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2454] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2456] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2459] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2461] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2465] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2466] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2467] PUT
2020/12/16 04:04:59 ...s/webhook/deliver.go:222:DeliverHooks() [E] deliver: Invalid http method for webhook: [2468] PUT

Description

We had working webhooks for matrix but after a recent update all of them started failing.
The interface to edit the webhook is blank.
All the attempts to send the webhook have NA for request / response and display EPOCH as the attempt date.

Screenshots

image

@ryexandrite ryexandrite changed the title Matrix Webhook fails - attempt displayes epoch as date Matrix Webhook fails - attempt displays epoch as date Dec 16, 2020
@ryexandrite
Copy link
Author

I have traced the cause to 42354df

I double-checked that the database migrations had run correctly, they have.

HTTP method is "PUT", typ is "matrix" in the DB table hook_task
Yet for some reason lin 80 in deliver.go

        case http.MethodPut:
                switch t.Typ {
		case models.MATRIX:
			req, err = getMatrixHookRequest(t)
			if err != nil {
				return err
			}
		default:
			return fmt.Errorf("Invalid http method for webhook: [%d] %v", t.ID, t.HTTPMethod)
	        }
	default:
		return fmt.Errorf("Invalid http method for webhook: [%d] %v", t.ID, t.HTTPMethod)
	}

hits those default statements.

@lunny lunny added the type/bug label Dec 25, 2020
@lunny
Copy link
Member

lunny commented Dec 25, 2020

Because there are some space on the column of typ because of wrong column type and I think this has been fixed but the wrong column content needs to be converted. Or we have to trimspace on the compare type.

@lunny lunny self-assigned this Dec 25, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants