SkygearIO / skygear-SDK-JS

Skygear SDK for JavaScript
https://docs.skygear.io/guides/quickstart/js/
Other
23 stars 33 forks source link

Couldn't upload asset in react native #467

Open limouren opened 6 years ago

limouren commented 6 years ago

Save a record leading to an asset save, an error will be thrown:

simulator screen shot - iphone se - 2018-11-06 at 16 01 41

The offending line should be: https://github.com/SkygearIO/skygear-SDK-JS/blob/c1a179043b7b3c3b46f5205f5633c8d444da3a78/packages/skygear-core/lib/database.js#L780

Expected Results

Record save successfully

Actual Results

Shown above.

Steps to reproduce

1. 2. 3.

limouren commented 6 years ago

If your app doesn't rely on Buffer, you could polyfill the global Buffer name to workaround it:

class FakeBuffer {}

if (typeof Buffer === 'undefined') global.Buffer = FakeBuffer;

Put it in your program's entry point.

Steven-Chan commented 6 years ago

Just did a search in source code. These are where the SDK use Buffer.

https://github.com/SkygearIO/skygear-SDK-JS/blob/master/packages/skygear-core/lib/database.js#L780 https://github.com/SkygearIO/skygear-SDK-JS/blob/master/packages/skygear-core/lib/asset.js#L58