Coldfusion 2018 to Lucee issue

Hi,

I’ve been handed a CF2018 app but we now use Lucee therefore I need to convert it, the app works 100% fine when run under CF2018 but when the same code is run under Lucee I get errors showing in the console such as 422 (Unprocessable Entity) polyfills.js:1
The issue seems to be originating from a file called get_evaluation.cfm which contains the following cfscript code:

response = getPageContext().getResponse();
response.setHeader('Content-Type', 'application/json');

try {
    request = getHTTPRequestData();
    
    body = deserializeJSON(toString(request.content));
    
    uuid = body['uuid'];

    if (isNull(uuid)) throw(type="UnprocessableEntityHTTPResponse",message="The request you submitted was invalid");

    evaluation = createObject('component', '/models.evaluation');

    try {
        evaluation.loadLatestByUuid(uuid).loadSections().loadElements();

        output = {
            evaluation = evaluation.toStruct()
        };

        response.setStatus(200);
    } catch (any error) {
        output = {
            message = "The requested evaluation could not be found",
            error = error
        };

        response.setStatus(404);
    }
} catch (any error) {
    output = {
        message = error.message
    };

    response.setStatus(422);
}

writeOutput(serializeJSON(output));

If I run this file by itself I get the following:
{“MESSAGE”:“key [CONTENT] doesn’t exist in the request scope”}.
It appears that it’s not finding the uuid value. Is there something obvious here that needs changed in order to get it working again?

I think the name request is reserved for the request scope in Lucee. Try replacing

request = getHTTPRequestData();
body = deserializeJSON(toString(request.content));

with

httpRequest = getHTTPRequestData();
body = deserializeJSON(toString(httpRequest.content));

thanks for getting back that seems to have fixed that particular issue but now getting this error in the console instead:

main.js:1 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading ‘weight’)
TypeError: Cannot read properties of undefined (reading ‘weight’)
at e.fill (main.js:1:798484)
at t.create (main.js:1:791025)
at e.project (main.js:1:814674)
at e._next (main.js:1:541901)
at e.next (main.js:1:532284)
at XMLHttpRequest.s (main.js:1:807439)
at e.invokeTask (polyfills.js:1:7960)
at Object.onInvokeTask (main.js:1:586367)
at e.invokeTask (polyfills.js:1:7881)
at t.runTask (polyfills.js:1:3144)
at j (polyfills.js:1:12949)
at j (polyfills.js:1:12507)
at polyfills.js:1:13737
at e.invokeTask (polyfills.js:1:7960)
at Object.onInvokeTask (main.js:1:586367)
at e.invokeTask (polyfills.js:1:7881)
at t.runTask (polyfills.js:1:3144)
at d (polyfills.js:1:10185)
at t.invokeTask [as invoke] (polyfills.js:1:9079)
at _ (polyfills.js:1:19971)

This looks like a Javascript Front End Error. Shouldn’t be related to Lucee.