Sink route / invalid content-type header

Im tryin to set up a sink route but i m gettin an content-type error on using it.

I followed https://docs.cortezaproject.org/corteza-docs/2021.3/devops-guide/extension-requirements/email-relay.html but if i try the example under Testing Corteza I always get an error from my curl command

echo "
From: sender@xxx.de
To: test@xxx.de
Subject: hello
Message-ID: 1234@local.machine.example
Ola Corteza!

" | curl -i --data-binary @- "https://corteza.xxx.de/api/system/sink?content-type=email&expires=&method=POST&origin=postfix&__sign=SINK

content-type: application/json
content-length: 706
vary: Origin
x-request-id: c2d8c44b2b51/liVDEaVYa7-014663
strict-transport-security: max-age=31536000; includeSubDomains

{“error”:{“message”:“invalid content-type header”,“meta”:{“resource”:“system:sink”,“type”:“invalidContentType”},“stack”:[{“func”:“service.sink.handleRequest”,“file”:"/drone/src/system/service/sink.go",“line”:250},{“func”:“service.(*sink).ProcessRequest.func1”,“file”:"/drone/src/system/service/sink.go",“line”:153},{“func”:“service.(*sink).ProcessRequest”,“file”:"/drone/src/system/service/sink.go",“line”:171},{“func”:“rest.(*Sink).ServeHTTP”,“file”:"/drone/src/system/rest/sink.go",“line”:20},{“func”:“chi.(*ChainHandler).ServeHTTP”,“file”:"/drone/src/vendor/github.com/go-chi/chi/chain.go",“line”:31},{“func”:“chi.(*Mux).routeHTTP”,“file”:"/drone/src/vendor/github.com/go-chi/chi/mux.go",“line”:424}]}}

i created the sink like this: docker exec 5ff3c0dce13a corteza-server sink signature --method POST --content-type email - which works well.

But i m not gettin it sorted out how to use it. I cant get rid of the error message complaining about content-type using the curl example from the docs.

Any ideas ? Thx :upside_down_face:

I addiitionaly tried curl with the following content headers. With no luck also.
curl -H "Content-Type: application/json"

Content-Type:plain/text
Content-Type:message/rfc822
Content-Type:application/json

Has anyone a working sink route and can assist?

Ok, i was able to debug it.

This works:

echo "
From: sender@xxx.de
To: test@xxx.de
Subject: hello
Message-ID: 1234@local.machine.example
Ola Corteza!

" | curl -H “Content-Type: email” -i --data-binary @- "https://corteza.xxx.de/api/system/sink?__sign=SINK

There seems to be a bug in the comparison in /corteza-server/system/service/sink.go:245

if srup.ContentType != “” {
if strings.ToLower(srup.ContentType) != contentType {
return nil, SinkErrInvalidContentType(sap)
}
}

The value of srup.ContentType is always email so all comparisons will fail, except for email.
So if i dont specify any value curl uses “application/x-www-form-urlencoded”. The example in the docs will never work, cause its not possible to override srup values.

Thank you for debugging this. I created a ticket for one of us to take care of.