coldfusioncoldfusion-2021

How to Fix Function [functionName] does not support [argumentName] as an argument in ColdFusion


I just updated my Adobe ColdFusion (ACF) 2021 to update 20 and I started receiving the following error, when trying to execute Testbox tests individually:

Function Runremote Does Not Support opt_run as an Argument

ACF update 19 didn't have this behavior.

What's the fix?


Solution

  • ColdFusion 2021 Update 20 adds a new JVM flag:
    -Dcoldfusion.runtime.remotemethod.matchArguments
    The flag defaults to true, which means that every remote CFC method must receive only the arguments that are explicitly declared with <cfargument> (or in the function header). If an extra named argument sneaks in, ColdFusion now throws an exception.

    To fix this, you have a few options:

    1. Add any missing arguments to your methods to prevent the exception from firing.

    2. Stop passing extra arguments to methods that aren't explicitly declared.

    3. In ColdFusion Administrator » Java & JVM (or jvm.config) add:
    -Dcoldfusion.runtime.remotemethod.matchArguments=false and restart CF services.

    4. If you're using CommandBox, disable this new "feature" by adding the following to your server.json file:

    "jvm":{
        "args":[
           "-Dcoldfusion.runtime.remotemethod.matchArguments=false"
        ]
    }
    

    Note: As pointed out by @happysailingdude, the hyphen (dash) at the beginning of the JVM argument is very important. Please don't forget about it.

    Sources:

    ACF 2021 Update 20 Notes:
    https://helpx.adobe.com/coldfusion/using/new-jvm-arguments-2023-2021-coldfusion-updates.html

    CommandBox Custom JVM Args:
    https://commandbox.ortusbooks.com/embedded-server/configuring-your-server/jvm-args