amplitude / experiment-ruby-server

Amplitude Experiment Ruby Server SDK
MIT License
2 stars 4 forks source link

Fetching fails when there is no payload #10

Closed jansi-z closed 2 years ago

jansi-z commented 2 years ago

Expected Behavior

Current Behavior

Possible Solution

I added some breakpoints to lib/experiment/client.rb, and I discovered that the JSON returned by the Amplitude call did not return any payload field. So this bit of code fails. One way to solve this would be to change value.fetch('payload') to value.fetch('payload', nil). It does look like Variant is able to handle a nil payload.

Steps to Reproduce

See under 'Expected Behavior'. Let me know if more information is needed.

Environment

qingzhuozhen commented 2 years ago

@jansi-z Thanks for reporting this issue! I will work on a fix for this soon!

qingzhuozhen commented 2 years ago

Hi @jansi-z I just deployed the new version v1.0.0-beta.4 including the fix. Feel free to upgrade the version and let me know how that goes. Thank you.

jansi-z commented 2 years ago

@qingzhuozhen Wow, thanks for picking this up so fast! I'll give it a try right away.

jansi-z commented 2 years ago

@qingzhuozhen My issue is fixed, so I'll close this! I'm getting variants now instead of an error. Thanks again for the fast response!