function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brian YarsawichBrian Yarsawich 

Debug logs not showing up for @RestResource

I'm trying to write a custom Rest endpoint for account linking. with an Alexa.  Right now the Alexa account linking will not update the access token for oAuth unless there is an expires_at field.  So I built an API to take the request from Amazon, send it to the salesforce oauth service, take the response from the oauth service, add in an appropriate expires_at time based on how long a session should last and return the xml to Amazon.

If I capture the request from amazon using request bin and then post it to the rest API I built with Postman, then the user is authenticated fine.  If I try to have amazon go directly to amazon then it fails and I can't find out why.  Amazon has no logs showing what it sends or recieves and I cna find no way to get a log from the rest API.  I tried adding a trace flag for the user it is authentication, the guest user for the community site, and on the actual apex class.  Nothing will produce a log for me to see what is actually happening.  I can't find out what if anything is the error.

Is there anyway to just create a debug log for a single apex class.
Daniel BallingerDaniel Ballinger
There was a change in Winter '17 whereby a debug log for a public site would only be captured if the inbound request included a particular cookie. This is a bit of a pain for all the integrations that rely on public facing web services.

See How can I get a debug log for the sites guest user/public profile? [updated for Winter 17] (https://salesforce.stackexchange.com/a/1150/102)
Brian YarsawichBrian Yarsawich
I was unable to add a cookie to the incoming request because it was coming from the Amazon Alexa app.  I did manage to get some semblance of logs by using a mix of requestb.in, postman and writing a test class for the endpoint.