stackvana / hook.io

Open-Source Microservice Hosting Platform
https://hook.io
Other
1.26k stars 117 forks source link

env vars not actually set? #200

Closed himynameisdave closed 8 years ago

himynameisdave commented 8 years ago

Am I stupid or something? I've been at this for a good hour now and I can't figure out how to set an environment variable & use it, which I thought would be much easier. I've searched all over for some documentation on this, best I found is a reference to this issue: #114 which indicates that sometime in the future env vars will be moved to each individual hook. Given that issue is still open, I figured they must still be global and not on a per-hook basis.

Steps Taken:

  1. Went over here and set new environment variable
  2. In a new public hook, I tested the following JavaScript code: console.log( hook.env )
  3. The result that is logged is { env1: 'val1', hello2: 'there' }

This makes no sense to me, as I do not see my created env variable, and on top of that I did not create env1 or hello2 so I don't know where they are coming from.

Is this a bug or am I missing something?

Marak commented 8 years ago

@himynameisdave -

Can you confirm that the env vars are not populating in your Hook service after it's created ( and not just in the hot-code test gateway )?

I just confirmed here that env vars for the hot-code gateway still have the wrong scope, but env vars for normal services are working.

This should have been resolved with #172

Will try to fix this tonight.

Marak commented 8 years ago

@himynameisdave -

Sorry for the inconvenience. I believe everything should be working now as expected.

Seems to have been a configuration issue on our end.

I discovered two things:

  1. It turns out some of the iframes for the hot-code gateways were still pointing to the legacy gateway hook. It's now pointing to the correct gateway-javascript hook.
  2. In addition, I made an out-of-app update to these same gateways hooks in couchdb, which in turn never invalidated the cached version of the gateway hook in redis. Need to be mindful of that in the future.

Making only a minor code change ( updating the iframe to use the new gateway hook ), seems to have resolved the issue.

Can you confirm it's working for you now?

Marak commented 8 years ago

Related #171

https://github.com/bigcompany/hook.io/commit/94d8c44561d2b16dec36cb419f4dc2f5a1298623

Marak commented 8 years ago

To clear, env is scoped per user, not per the entire system.

Issue #114 refers to making a new env scoped locally per hook.

himynameisdave commented 8 years ago

@Marak thanks a whole bunch for the quick turnaround :+1:

Marak commented 8 years ago

Is it working now?

Please let me know if / when you find any additional issues.

himynameisdave commented 8 years ago

@Marak yes confirmed it is working, keep up the awesome work and let me know if you need a hand with anything :+1: