You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update Environment Variables call is not able to delete Environment Variable v3 #1203
If a null value is sent in UpdateApplicationEnvironmentVariableRequest for ApplicationsV3().updateEnvironmentVariables, it does not delete the variable form the application. It even does not changes the value of the variable.
The provided code snippet for the v2 API worked successfully: java:
cloudFoundryOperations.applications()
.unsetEnvironmentVariable(UnsetEnvironmentVariableApplicationRequest.builder()
.name(appName)
.variableName(key)
.build());
However, when we attempted to use the v3 API with similar logic, it failed. java:
cloudFoundryClient.applicationsV3()
.updateEnvironmentVariables(UpdateApplicationEnvironmentVariablesRequest.builder()
.applicationId(applicationResource.getId())
.var(key_var_name, null)
.build());
For reference, I tested the v3 API directly using Postman, referencing this link, and it succeeded by sending null in the payload request body. However, the same approach failed when using the cf-java-client library.
Could you please help? incase if we are missing something
FYI: I have added the latest jar of
cloudfoundry-client, client-reactor, operation, util - version 5.12.1
Activity
bhavinshahM commentedon Mar 26, 2024
Hello @anthonydahanne , @cf-buildpacks-eng , @dmikusa
Please help!
I am also not able to delete the environment variable using the call.
Here is my code block: Please suggest what to do!
cloudFoundryClient.applicationsV3()
.updateEnvironmentVariables(UpdateApplicationEnvironmentVariablesRequest.builder()
.applicationId(applicationResource.getId())
.var(key_var_name, null)
.build())
.timeout(CF_REQUEST_TIMEOUT)
.block();
anthonydahanne commentedon Mar 26, 2024
hello!
sorry for late answer!
did that work fine with v2 api? is it a regression introduced with v3 ?
Thanks!
bhavinshahM commentedon Mar 26, 2024
Thank you for your prompt response, @anthonydahanne
The provided code snippet for the v2 API worked successfully:
java:
cloudFoundryOperations.applications()
.unsetEnvironmentVariable(UnsetEnvironmentVariableApplicationRequest.builder()
.name(appName)
.variableName(key)
.build());
However, when we attempted to use the v3 API with similar logic, it failed.
java:
cloudFoundryClient.applicationsV3()
.updateEnvironmentVariables(UpdateApplicationEnvironmentVariablesRequest.builder()
.applicationId(applicationResource.getId())
.var(key_var_name, null)
.build());
For reference, I tested the v3 API directly using Postman, referencing this link, and it succeeded by sending null in the payload request body. However, the same approach failed when using the cf-java-client library.
Could you please help? incase if we are missing something
FYI: I have added the latest jar of
cloudfoundry-client, client-reactor, operation, util - version 5.12.1
bhavinshahM commentedon Mar 27, 2024
Hello @anthonydahanne
It's urgent! can you please check once? It would be very much helpful for me :)
Thank you in advance!
LitschiW commentedon Jul 8, 2024
see also #1232 . This might be the same issue of the ObjectMapper not serializing null-Objects.