-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test Code behavior different from Run Hook #171
Comments
Good catch! That's good to know. First off, all "test hook" code is run through the live code execution gateway. This is a slightly separate code path than normal deployment. see: https://github.com/bigcompany/hooks/blob/master/gateway-javascript/index.js Secondly, in this case, I believe that the datastore is going to be scoped to the owner of the It's possible datastore is not working correctly for the testing gateway, but it's also likely that the I think it would be best to have all test code gateways be scoped to a general anonymous user when no session, and if a session is present, scoped to that user's data. |
OK. Thanks. I suppose it means the env is from the anonymous user too. That explains the inconsistencies of the same hook not working in test mode, but working in deployment. |
Leaving open for now. It's possible we might find other discrepancies and can track them to this issue. Once we know they both act the same, we can close. |
* JavaScript hot-code gateway datastore scope * Closes #172
* Scopes hot-code gateway to session env scope * Works for all hot-code gateways * Adds concept of `hookType` ( internal use )
This should be resolved locally.
The reason there is a scoping issue for the hot-code gateways is that every gateway is owned by user "marak". We could mitigate this issue by having every user fork the existing hot-code gateways to their own account ( since they are just hooks ), and that would ensure the correct scope always exists for the gateways. Since it's not very convenient for every user to create a copy of the hot-code gateway, I added some special logic for binding the "marak" owned hot-code gateways to the currently logged in session. This should resolve any current issues with testing code. test code @monkbroc I'll let you know when this is deployed and ready for testing. |
Thanks @Marak! |
I've pushed and deployed this now. Still haven't fully tested it in production, but I assume it's working. All hot-code gateways should be respect the scope of the currently logged in user. This should result in no more cross contamination of Thanks again for your feedback! |
I've seen several difference in behavior between the Test Code button and the running the actual hook.
Here's one:
https://hook.io/admin?owner=monkbroc&name=test-test
Running the hook outputs
45
Clicking Test Code outputs
[object Object]1111
The text was updated successfully, but these errors were encountered: