stratos icon indicating copy to clipboard operation
stratos copied to clipboard

V3 API - Variable tab: Empty environment_json returns null

Open KlapTrap opened this issue 6 years ago • 1 comments

If you deploy a v3 application (that will end up with no environment_json) and visit the variables tab you will see the below exception:

core.js:1671 ERROR TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at MapSubscriber.project (cf-app-variables-data-source.ts:42)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/map.js.MapSubscriber._next (map.js:75)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93)
    at DistinctUntilChangedSubscriber.push../node_modules/rxjs/_esm5/internal/operators/distinctUntilChanged.js.DistinctUntilChangedSubscriber._next (distinctUntilChanged.js:99)
    at DistinctUntilChangedSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93)
    at SwitchMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/switchMap.js.SwitchMapSubscriber.notifyNext (switchMap.js:111)
    at InnerSubscriber.push../node_modules/rxjs/_esm5/internal/InnerSubscriber.js.InnerSubscriber._next (InnerSubscriber.js:20)
    at InnerSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93)
    at RefCountSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:129)

There is a disparity in how the V2 api handles a v2 application with an empty environment_json and a v3 application with an empty environment_json. The v2 application will return environment_json as an empty object {} whereas the v3 application will return environment_json as null.

In both case outline above, we attempt to pass the environment_json into Object.keys causing an exception when environment_json is null.

KlapTrap avatar Jan 31 '19 12:01 KlapTrap

Is there any news on this? We identified this bug also, when customers with new CF apps are not able to add an environment variable before adding (and removing) one via cli or manifest. We are looking at the code to find the right spot where to fix it and are open to any help or feedback.

mauricebrinkmann avatar Oct 31 '22 09:10 mauricebrinkmann