beam-community/stripity-stripe

Stripe.Converter.convert_result not returning struct

sb8244 opened this issue · 0 comments

I ran into an issue in my test suite where Stripe.WebhookHandler handle_event receives an object that isn't a struct. I tracked this down in the code to the check known_struct?/1

I believe the issue here is that in some envs (not sure how prod vs dev vs test works here), the build modules aren't preloaded. So if you check function_exported? before the module is loaded, it will always return false.

https://github.com/sb8244/stripity-stripe/blame/main/lib/stripe/converter.ex#L118

I may be wrong here, so I didn't PR a fix yet. My fix for now will be to manually ensure the necessary stripe files are loaded using Code.ensure_loaded!