Why back-end methods fail on received webhook but succeed when run manually/supervised

@jonatandor35 So I refactored the webhook receiver function to use async/await and it made it clear that you were right about my if-condition always being true — thank you!

However, the initial problem remains unsolved: when a webhook is received, methods called by the handler ultimately fail with ‘undefined’ message.

Here’s an example from today relevant to the code snipped that I presented earlier: a product name was changed on the other platform, the webhook handler executed updateProduct routine and it errored:

This is where it gets confusing: line 235 (corresponds with line 101 in my gist) lands me on statement which shouldn’t even be executed in the first place, because there are no variants for this product and those conditions can’t be met:

During the testing period, there were other webhook handling errors showing rather strange locations in my code. Like the time when it errored on a line with just a closing parenthesis or a commented out line (I’ll try and screenshot them next time)