Migrating UDFs from ACF

I’m currently migrating an existing application from ACF to Lucee. It uses a script based UDF, residing in an cfinclude which is also used to set various REQUEST vars like DSN etc. This is included via onRequestStart in Application.cfc. Both Application.cfc and the cfinclude file reside in the webroot.

In a dump of REQUEST I can see all the vars are set OK but the UDF is not available and any calls to it fail with No matching function found errr.

I have tried relocation of the UDF into its own file in /WEB-INF/lucee/library/function and refactoring into a tag based function but neither works. I’ve also located the UDF directly in the onRequestStart in Application.cfc file

I have been through the Lucee admins looking for a setting I maybe missing. As both files are within the root I don’t see that I need a mapping.

So I’m stuck - I have scanned the Lucee docs looking for recommendstions/best practices on location of UDFs but I can’t find anything as yet.

Am I missing something really obvious / stupid?

Thanks for reading - any help or advice gratefully received.

Cheers

Dom

where are you dumping the request out, in the application.cfc or the cfm?

In a cfm in the same directory as Application.cfc

if you call the include file directly, the dump is also missing the udf? can you share a code snippet?

Ah, thanks for the prompt Zac! :grinning: I just realised that the error is coming from a file that’s included outside the webroot :flushed:

  • wwwroot/Application.cfc (includes config)
  • wwwroot/conf/config.cfm (with checkMyURL UDF)
  • wwwroot/test.cfm
  • includes/header-inc.cfm

So I can call checkMYURL() from wwwroot/test.cfm but not from includes/header-inc.cfm

I see from the docs that Lucee doesn’t look outside the webroot, is there a way I can configure it to do so?

where is includes/header-inc.cfm being included from if it’s outside the webroot?

wwwroot/index.cfm is including …/includes/header-inc.cfm

However, meantime I’ve rebooted lucee and cleared the template cache and this has started working, so the No matching function [CHECKMYURL] found error has disappeared.

I’m not sure I understand why, as everything is as before?

Anyway, I appreciate your help Zac, thanks very much.

Dom