'Referencing Folder-level scope credentials in declarative Jenkins pipeline

Question

I have the following script as part of a declarative pipeline in Jenkins

stages {
    stage('sql') { 
        steps {
            step([
                $class: 'SQLPlusRunnerBuilder',
                credentialsId:"sis-database-prod-schema-test",
                instance:"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db_${ENVIRONMENT}.int.excelsior.edu)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=${ENVIRONMENT})))",
                scriptType:'userDefined', 
                script: '',
                scriptContent:"select*from dual",
                customOracleHome: '/usr/lib/oracle/12.2/client64'
            ])
        }
    }
}

You will notice I am referencing the credential ID sis-database-prod-schema-test. When I scope this credential globally this script works. However, when I scope the credential at the folder level it get the following error

ERROR: Invalid credentials [sis-database-prod-schema-test]. Failed to initialize credentials or load user and password

Here is a screenshot of my folder-level scope configuration

folder-level scope

Additional Information

When I scope the credential at the folder level I can see it in a configuration drop down element ONLY when I am in the appropriate folder. So, in my mind, the scope configuration is correct but there referencing ( in the code ) is wrong.

enter image description here

The entry I have highlighted is the sis-database-prod-schema-test credential ID. The one below it ( sis-test-database-prod-schema ) is a global credential unrelated to this question

Edit : This Was a Known Issue

This is a known bug that the author was unable to fix. The relevant code is here. You can issue a pull request to fix the bug.



Solution 1:[1]

Known Issue

This is a known bug that the author was unable to fix. The relevant code is here. You can issue a pull request to fix the bug.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris Maggiulli