Jenkins Credential Interpolation issue within shell script

Hi All,
Recently we had upgraded our Jenkins version from 2.375.3-lts to 2.401.1-lts, After the upgrade was complete we saw failure on our pipelines in cases where we were using a withCredentials block, an example snippet :
withCredentials([usernamePassword(credentialsId: 'creds-id', usernameVariable: 'USER', passwordVariable: 'PASS')]){ sh('curl --request GET www.example.com -u $USER:$PASS --output resp') }
When we try to run this specific code snippet in any pipeline, we noticed that the values for the credential variables USER and PASS were not being interpolated to the shell script command and instead we just get an empty user and pass field in the console log during execution.

We didn’t have this issue with version 2.375.3-lts and are unable to link it specifically to any other plugins, has anyone encountered a similar issue? If so, how did you manage to fix it?

Hi,
Your code does not follow Groovy Interpolation
please change '"
From:

    withCredentials([usernamePassword(credentialsId: 'creds-id', usernameVariable: 'USER', passwordVariable: 'PASS')]){ 
        sh('curl --request GET www.example.com -u $USER:$PASS --output resp') 
    }

To:

    withCredentials([usernamePassword(credentialsId: 'creds-id', usernameVariable: 'USER', passwordVariable: 'PASS')]){ 
        sh("curl --request GET www.example.com -u $USER:$PASS --output resp") 
    }