question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support react-native

See original GitHub issue

I am going through the tutorial and I hit an error when I try to connect to the local websocket server from my React Native app. The error is:

Error: Buffer is not defined
 stack: 
  Function.<anonymous>                                         index.ios.bundle:64324
  Function.module.exports.varar [as expr]                      index.ios.bundle:58951
  Table.<anonymous>                                            index.ios.bundle:61785
  Table.RDBOp [as constructor]                                 index.ios.bundle:61791
  new                                                          index.ios.bundle:62148
  Function.<anonymous>                                         index.ios.bundle:64402
  Function.module.exports.aropt [as table]                     index.ios.bundle:58972
  React.createClass.componentDidMount                          index.ios.bundle:1493
  CallbackQueue.assign.notifyAll                               index.ios.bundle:6674
  ReactNativeReconcileTransaction.ON_DOM_READY_QUEUEING.close  index.ios.bundle:16780
  ReactNativeReconcileTransaction.Mixin.closeAll               index.ios.bundle:7214
  ReactNativeReconcileTransaction.Mixin.perform                index.ios.bundle:7155
  batchedMountComponentIntoNode                                index.ios.bundle:7516
  Object.ReactDefaultBatchingStrategy.batchedUpdates           index.ios.bundle:16560
  Object.batchedUpdates                                        index.ios.bundle:6444
  Object.ReactNativeMount.renderComponent                      index.ios.bundle:7600
 URL: undefined
 line: undefined
 message: Buffer is not defined

Some relevant code:

var ReactRethinkdb = require('react-rethinkdb');
var r = ReactRethinkdb.r;

//...

ReactRethinkdb.DefaultSession.connect({
  host: 'localhost',
  port: 8015,
  path: '/db',
  secure: false,
  db: 'test',
});

//...

    console.log(r.table('turtles'));

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:49 (20 by maintainers)

github_iconTop GitHub Comments

4reactions
lifuzucommented, May 3, 2016

+1 Just got in. I believe it is really an excited feature for react native and rethinkdb!

4reactions
mikemintzcommented, Sep 11, 2015

I actually just tried to do this yesterday. I should have posted something about it. Try running this:

$ npm install buffer --save

And then add this to the top of the first javascript file you run (like index.ios.js):

global.Buffer = global.Buffer || require('buffer').Buffer;

Also, I think you’ll need to require('react-rethinkdb/dist/node') instead of require('react-rethinkdb') since it’s not running in a browser environment.

However, after I did all that, I ran into errors about some unknown http module, and didn’t have enough time to resolve that yet. Let me know if you run into the same thing, or something else first, or find a way around it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where to get help
If you need help with your React Native app, the right place to go depends on the type of help that you need....
Read more >
Where To Get Support
Where To Get Support. React has a community of millions of developers. On this page we've listed some React-related communities that you can...
Read more >
React Native Support
React Native Support ... Meta's React Native and Developer Tooling teams work in close collaboration to ensure Flipper offers top-notch out-of-the-box value for ......
Read more >
React Native Experts to Help, Mentor, Review Code & More
Find a freelance React Native expert for help with reviewing code, mentorship, tutoring, and other React Native help you might need.
Read more >
What Is React Native? Complex Guide for 2022
React Native is a name you hear a lot in the mobile app development world. ... it up with Android support, before taking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found