Issues when using SDK on the backend
If you are running into issues when SDK is used on the backend then follow this quide.
XXXX is not defined
If you're using create-react-app and getting process is not defined
or buffer is not defined
or similar errors
Install needed packages
yarn add os-browserify
yarn add stream-browserify
yarn add path-browserify
yarn add process
yarn add crypto-browserify
yarn add buffer
Customize webpack
const webpack = require('webpack');
module.exports = function override(config, env) {
config.resolve.fallback = {
"os": require.resolve("os-browserify/browser"),
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
"process/browser": require.resolve("process/browser"),
"crypto": require.resolve("crypto-browserify"),
"http": false,
"https": false,
};
config.plugins.push(
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
);
return config;
}