6.2.0.164-RC - REST Endpoint creation fails

OS: Ubuntu/Docker official Lucee Release
Lucee Version: 6.2.0.164-RC

When deploying an app via the official Lucee Docker container, the REST endpoints occasionally fail on a fresh deployment.

Code:
[Application.cfc / onApplicationStart()]
RestInitApplication(dirpath=expandPath('./rest'), serviceMapping='admin-config', default=false, password="admin-password");

[rest/ext.cfc]

component restpath="/ext" rest="true"
{

    remote function getAppExtList() httpMethod="GET"
    {
        return "Hello!";
     }
}

Postman Call to https://localhost/rest/admin-config/ext/ Method=GET
no rest service for [/admin-config/ext/] found

This setup works when running on the lucee/lucee:5.4 docker image. Anything beyond 6.0 seems to cause it to break.

If I log into the Lucee Server Admin, I see that the REST endpoints were not created. If I switch to multi-mode or futz around with some of the settings, then the REST endpoints can be created programmatically. It seems that once a single REST endpoint is showing up in the Server admin, they work as expected (switching from multi-mode to single mode works again). Restarting the container with a fresh build/deployment causes the issue to pop up again.

I haven’t opened a ticket yet – not sure if it is related to the multi-server issue with REST endpoints – since it looks like that one got closed a long while ago (but can’t track down if that bug fix was included in the RC).

The above code produces the same issue. However, you need to create the REST mapping during the initial setup before providing the REST URL. In this case, you tried to run the REST API, but the REST mapping was not created beforehand, which caused the issue and prevented it from reaching the Application.cfc. So, please ensure that you create the REST mapping in the web admin interface

I do make sure the endpoint is created before I hit the endpoint. In my test case, I’ll hit an index.cfm or something similar. This is expected and how 5.x has always worked.

In 6.2.0 RC, the RestInitApplication() will run, but the endpoint is still not created.

Could you please provide the version you are currently working with? I am facing the same issue in version 5.4: 'No REST service for [/admin-config/ext/] found.'
Also, before checking, please clear the lucee-web.xml.cfm file [WEB-INF/lucee/lucee-web.xml.cfm], or if the REST mapping is configured in it, remove it manually and test your REST URL

Created a sample GitHub repository with sample code and Docker setup for easy testing of this bug :

I’ve been able to test the above code successfully with pretty much every 5.3 and 5.4 release that I could find.

As soon as I jump to anything in the 6.x release train, the above code fails. Even though the RestInitApplication() function fires, the REST endpoints are NOT created. IF I install the Lucee Administrator and enable it, login, modify or add an Endpoint, REST endpoint creation works via the RestInitApplication() from that point on for all applications. This has been tested and reproduced with 6.0.4.10, 6.1.1.118 and 6.2.0.164-RC.

It almost feels like the RestInitApplication code is looking to add a node in the .CfConfig file, and if it does not already exist, it fails silently. I’m not familiar enough with the code to sus out if that’s actually the case, but a sure-fire way to get the above to work in the 6.x release train is to dump into the Lucee admin and do something/anything with the REST endpoint section. This of course, does not work well when we are deploying these in containers.

I also ran into same issue when creating REST endpoints and deploying with Lucee Docker containers. Is it possible to create rest mappings in .CFcinfig.json?

You can – but it’s currently undocumented. They point to the cfconfig docs over at Ortus, and they marked it as “TODO – coming soon”