Hello everyone! Need some help hunting down cause ...
# box-products
Hello everyone! Need some help hunting down cause of error in a rest api. The route is suppose to receive an email address then send a reset password email to that email address. The email sends fine and looks fine, but the route returns a 500 internal server error. The stack trace says error is missing include could not find template //views/auth/createPasswordChangeRequest which shouldn't be a view at all, it's a service function. it almost seems like as soon as it renders the email it stops trying to return an api request, and instead a view? I have found 2 things that seem to fix it. if I change from coldbox.system.RestHandler to a custom handler, it seems to work fine.
Copy code
// *** this line below **
component extends="coldbox.system.RestHandler" {
  function createPasswordChangeRequest(event,rc,prc){       

        //Authenticate User
        var result  =  userService.createPasswordChangeRequest(argumentCollection=rc);
        //Configure Results
that's my handler or if I change in our email service this Renderer.renderLayout to just a string I don't get the error either.
Copy code
	threadSafe	= "true"
	output		= false
	hint  		= "mail service help to mailService@cbmailservices" {

	property name="cbMailService" 	inject="mailService@cbmailservices";
	property name="Renderer"     	inject="Renderer@coldbox";
	property name="ENVIRONMENT" 		inject="coldbox:setting:ENVIRONMENT";
    property name="CONFIG"              inject="coldbox:configSettings";

	emailService function init(){
		return this;

	public struct function send(required string layoutName, required string viewName, required struct settings, string type) {

		// Create mail service object
		var emailPayload = cbMailService.newMail();

		// Set the settings

// ******** these lines *****
var result = cbMailService.send(emailPayload);

		return result;
any insight would be super appreciated I would love to be able to use the coldbox.system.resthandler and renderer.renderlayout together but I keep getting that error response.
Your handler should be
but you just are setting the private scope (prc).
just gave it a try and still getting that same missing include error.
Did you reinit your app and all that?
I just doubled checked reinit'd and tried again, I did have to do event.getResponse().setData but still getting same missing include error.
It would appear the CodBox request is trying to go through the normal flow of including the convention view.
☝🏾 1
Since this is using the base rest handler and returning an array, I would expect the default behavior to be a JSON data rendering.
I don't understand what you mean when you say
or if I change in our email service this Renderer.renderLayout to just a string I don't get the error either.
Also, if you comment out the userservice stuff and just set a dummy array data, are you saying it works fine?
It sounds like you're saying that any direct usage of the renderer in the request, is changing ColdBox's render data settings. Is that correct?
@Zac Warner
yes so if I don't call the Renderer.renderlayout. it works fine
Can you compare rc and prc before and after to see what changes?
or if I don't use the coldbox.system.RestHandler. it seems to work
looks like a currentLayout gets added to prc after Renderer.renderlayout
If you manually remove that, does it work?
If so, I think we have enough to put I a ticket
After removing currentLayout it still errors out.
Well, find out what else is getting set 😀
It pretty much has to be in the request scope or the requestcontext
I still think that it might be that layout. We're just not manually removing it in the write place? cause it does show up in the stack trace of the error
I'd clear it before exiting the handler
Also, are you setting it to an empty string or deleting the key?
And what was it before the renderer call?
we tried using struct.delete after the service call that uses the renderer but inside the handler still