-
Notifications
You must be signed in to change notification settings - Fork 129
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
TypeError: instanceof called on an object with an invalid prototype property. #192
Comments
Unfortunately BigInt is not natively supported by the JavaScriptCore
implementation on iOS. I attempted to polyfill it as much as I could, but
it won't work natively. It should not crash however.
…On Mon, Sep 14, 2020, 9:20 AM Carlos Jr. Tee ***@***.***> wrote:
This happens when axios receives an error response from server:
TypeError: instanceof called on an object with an invalid prototype
property.
Assertion failed: (exception==0), function exec, file
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/V82JSC.h,
line 286.
#0 0x00000001bc0b995c in __pthread_kill ()
#1 <#1>
0x00000001d68fb9e8 in pthread_kill ()
#2 <#2>
0x000000019ac52934 in abort ()
#3 <#3>
0x000000019ac51d34 in
*assert_rtn () #4 <#4>
0x0000000101c4dd3c in V82JSC::exec(OpaqueJSContext const*, char const*,
int, OpaqueJSValue const* const*, OpaqueJSValue const**) at
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/V82JSC.h:286
#5 <#5> 0x0000000102319130
in is*(v8::Value const*, char const*) at
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Value.cpp:27
#6 <#6>
0x0000000102319ff8 in v8::Value::IsBigIntObject() const at
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Value.cpp:399
#7 <#7>
0x00000001020f8a5c in node::(anonymous
namespace)::IsBoxedPrimitive(v8::FunctionCallbackInfov8::Value const&) at
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/deps/node-10.15.3/src/node_types.cc:59
#8 <#8>
0x000000010228f440 in OpaqueJSValue const* callAsCallback<OpaqueJSValue
const*>(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned
long, OpaqueJSValue const* const*, OpaqueJSValue const**) at
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Template.cpp:249
#9 <#9>
0x000000010228ec08 in
V82JSC::Template::callAsFunctionCallback(OpaqueJSContext const*,
OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*,
OpaqueJSValue const**) at
/Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Template.cpp:281
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#192>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJC4ZFPKUHTXELGTIAXEPDSFW72VANCNFSM4RLHWXQA>
.
|
Thanks for responding. I don't need BigInt support directly though. I don't think axios needs it either. The BigInt checking is part of IsBoxedPrimitive condition and somehow axios receiving a web API error response crashes it. What can I do to troubleshoot this further? |
Narrowed it down to a console.log call where I passed the axios error response directly.
|
Maybe try a polyfill. Something like this at the very beginning of your code before axios is loaded: class Foo {}
global.BigInt = new Foo() That should make sure |
Let me try that. I'm running it on iOS 14 beta 8 via Xcode 12 beta 6. |
It looks like BigInt has been added to JavaScriptCore in iOS 14: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt (see compatibility table -- added in Safari for iOS 14) So this may be an iOS 14-only problem, in that there is a native implementation and that native implementation does not have a prototype. If so, that line of code needs to change somehow. Not sure how just yet. |
I couldn't get the polyfill to work. The closest I got was getting a different error but that's just my limited javascript experience.
Our app targets iOS 14 so I would't be able to test this on Apple's current release but I'm expecting Apple to release iOS 14 within this month. I guess for now I'll just have to stop passing the error responses directly to console.log. |
This happens when axios receives an error response from server. I only encounter this on iOS. LiquidCore on android is able to handle the error response with no issue.
Error Log:
TypeError: instanceof called on an object with an invalid prototype property.
Assertion failed: (exception==0), function exec, file /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/V82JSC.h, line 286.
Xcode stacktrace:
#0 0x00000001bc0b995c in __pthread_kill ()
#1 0x00000001d68fb9e8 in pthread_kill ()
#2 0x000000019ac52934 in abort ()
#3 0x000000019ac51d34 in assert_rtn ()
#4 0x0000000101c4dd3c in V82JSC::exec(OpaqueJSContext const*, char const*, int, OpaqueJSValue const* const*, OpaqueJSValue const**) at /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/V82JSC.h:286
#5 0x0000000102319130 in is(v8::Value const*, char const*) at /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Value.cpp:27
#6 0x0000000102319ff8 in v8::Value::IsBigIntObject() const at /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Value.cpp:399
#7 0x00000001020f8a5c in node::(anonymous namespace)::IsBoxedPrimitive(v8::FunctionCallbackInfov8::Value const&) at /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/deps/node-10.15.3/src/node_types.cc:59
#8 0x000000010228f440 in OpaqueJSValue const* callAsCallback<OpaqueJSValue const*>(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) at /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Template.cpp:249
#9 0x000000010228ec08 in V82JSC::Template::callAsFunctionCallback(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) at /Users/ctee/Documents/pf-ios/1/Pods/LiquidCore/LiquidCore/src/ios/V82JSC/Template.cpp:281
instanceof being referred from this line in Value.ccp:
IS(IsBigIntObject, "return _1 && typeof _1 === 'object' && (typeof Object.prototype.valueOf(_1) === 'bigint' || Object.prototype.valueOf(_1) instanceof BigInt.proto)")
The text was updated successfully, but these errors were encountered: