A few years ago, Salesforce disabled debug logs for REST guest calls. The only way to enable generating the logs is to add a cookie to the incoming call. Docs here.
The incoming call in my case is coming from Twilio. Twilio says you can add a cookie by returning a set-cookie parameter in the response header.
However, the docs on RestResponse say:
Please note that the following headers aren't allowed: cookie set-cookie
And, indeed, when I try this:
... Twilio tells me the response was an Apex exception:
"errorCode": "APEX_ERROR", "message": "System.InvalidHeaderException: Header name \"Set-Cookie\" is not allowed.\n\nClass.System.RestResponse.addHeader: line 13, column 1\nClass.proton7.IncomingSMS_MMS.handleSMS_MMS: line 100, column 1"
So, at least the docs are correct. But that leaves me with no way to set a cookie, and no way to generate some much-needed debug logs.
Any workarounds you can think of?
(I have a support ticket in to Twilio, asking if I can set the cookie via their console, or with a cUrl.)