j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

Getting errors from CDVPurchase.Utils.safeCall #1557

Open heffthedev opened 3 weeks ago

heffthedev commented 3 weeks ago

Following error occurs usually when starting the app: undefined is not an object (evaluating 'callback.name')

Seems to be related to the safeCall funciton found in safe-callback.ts

This code seems to be the culprit:

    export function safeCall<T>(logger: Logger, className: string, callback: Callback<T>, value: T, callbackName: string | undefined, reason: string): void {
      if (!callbackName) {
        callbackName = callback.name || ('#' + md5(callback.toString()));
      }

found in https://github.com/j3k0/cordova-plugin-purchase/blob/master/src/ts/utils/safe-callback.ts

Not sure if the error is purely related to my code somehow, I couldn't find the cause for it in it yet at least. But I guess a safecall function should not be so picky? ;)

Anyway, if it ends up being my own code's fault, I'd be happy if anyone can point me in the right direction.

Using the latest release of the plugin as of writing: 13.10.1

Cheers.