cloudfoundry-community / node-cfenv

easy access to your Cloud Foundry application environment for node
Apache License 2.0
74 stars 20 forks source link

handle ports race condition by returning 3000 #41

Closed pmuellr closed 5 years ago

pmuellr commented 5 years ago

fixes https://github.com/cloudfoundry-community/node-cfenv/issues/40

This is a very simple to fix to the problem with ports where it will occaisonally throw an error:

The fix is to catch the error and use port 3000. Not great, but should handle some cases where this was a problem.

An alternate fix to try would be to try fetching the port again, probably in a loop (with some limit), in hopes of getting a value from ports.