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.

global.TYPED_ARRAY_SUPPORT is undefined for react-native

See original GitHub issue

I get the above error on import AWS from 'aws-sdk/dist/aws-sdk-react-native. Others have gotten when using babel-preset-env instead of module:metro-react-native-babel-preset

"@babel/runtime": "^7.1.2",
"aws-sdk": "^2.198.0",
"buffer": "^5.2.1",
"@babel/plugin-transform-runtime": "^7.1.0",
"metro-react-native-babel-preset": "^0.48.2",
"react": "^16.6.0-alpha.8af6728",
"react-native": "^0.57.4",

I fixed it by editing node_modules/aws-sdk/dist/aws-sdk-react-native.js and changing the below code to Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport().

// https://i.imgur.com/xyjLBOl.jpg
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
	  ? global.TYPED_ARRAY_SUPPORT
	  : typedArraySupport()

I believe this is a problem with babel polyfilling global and is maybe related to webpack.

More in depth troubleshooting at https://github.com/aws-amplify/amplify-js/issues/803 and https://github.com/aws-amplify/amplify-js/issues/2005

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
srchasecommented, Jan 15, 2019

Thanks for following up. I’ll close out this issue for now. If it reoccurs, let us know and we can re-open the issue.

0reactions
lock[bot]commented, Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to force TYPED_ARRAY_SUPPORT in buffer to false for ...
Simply put global.Buffer.TYPED_ARRAY_SUPPORT = false; in global.js and shim in your global.js as early in the app as possible to ensure it ...
Read more >
A brand new website interface for an even better experience!
global.TYPED_ARRAY_SUPPORT is undefined for react-native.
Read more >
How to fix the ReferenceError: global is not defined error in ...
I spent hours trying to figure this out and it was really difficult to find the exact information on the web since this...
Read more >
React Native Support in the AWS SDK for JavaScript
You can now access all services that are currently supported in the AWS SDK for JavaScript from within a React Native application.
Read more >
Babel - Cannot read property 'TYPED_ARRAY_SUPPORT' of ...
Coding example for the question Babel - Cannot read property 'TYPED_ARRAY_SUPPORT' of undefined-babel.js.
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