Describe the bug
When trying to initialize a subscription on React Native, error is thrown

To Reproduce
$ npx react-native init rnamplify
$ cd rnamplify
$ yarn add aws-amplify
$ amplify init
$ amplify add api
Schema
type Todo @model {
id: ID!
name: String!
description: String
}
See this snippet or similar for code example.
Expected behavior
subscriptions work
__Details__
Reported by customer here. Tested with Amplify 2.2.2 and 2.2.4. Tried a lot of stuff before filing this bug to be sure it wasn't something on mine or the customer's machine or env.
Smartphone (please complete the following information):
Additional context
Works fine on a web project
This also fails on an Android device. By simply following the documentation, it occurs immediately.
What I am seeing is that it fails on this line with the error Buffer is not defined. I resolved this by adding the following at the start of my react-native app:
global.Buffer = require('buffer').Buffer;
For some odd reason, the buffer is not available, but by forcing it into the global scope, it does seem to work.
Nice find @callaars, thanks for the heads up and update. We're looking at a native fix for this now.
Starting to dig into this with the team
Thanks @dabit3, the issue is confirmed and I am working on a fix right now
Fix published into unstable tag tomorrow it will be published into latest tag
Thanks @elorzafe @sammartinez !!
Most helpful comment
Fix published into
unstabletag tomorrow it will be published intolatesttag