undefined is not an object (evaluating Transform.call') React Native
Getting this error in react-native using crypto-browserify.
Have setup .babelrc like this:
"plugins": [ ["babel-plugin-rewrite-require", { aliases: { crypto: 'crypto-browserify', } }]
Any solution for this issue? - I am facing it too!!
My babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [ ["babel-plugin-rewrite-require", { aliases: { crypto: 'crypto-browserify' } } ] ]
};
I also have this issue, it comes from cipher-base, a dependency, assuming we're in Node.js and that we have the stream package with a .Transform object in it -- which we don't.
The solution is to install readable-stream from npm and create an alias using your transpiler thing (browserify, webpack, rollup etc.) from stream to readable-stream.
See https://github.com/crypto-browserify/cipher-base/issues/10#issuecomment-642491728, for example.
Hello Everyone, I am facing the same issue ### [TypeError: undefined is not an object (evaluating 'Transform.call')] When I am trying to make the API Call:
try {
const userId = yield select(makeSelectUserId())
const deviceId = yield getUniqueId()
const API_URL = `${API_BASE_URL}/users/personalization/api`
const jsonBody = JSON.stringify({
userId,
deviceId,
usecases,
googleAdId
})
console.log("jsonBody------------->>>>>>>>>>>>>", jsonBody);
const reqBodyDigest = crypto.createHmac('sha1', PERSONALIZATION_AUTH_KEY)
.update(jsonBody)
.digest('hex');
const { data: { data } } = yield call(request, API_URL, {
method: 'POST',
header: reqBodyDigest,
data: JSON.stringify({
userId,
deviceId,
usecases,
googleAdId
})
})
console.log("Personalized Data---------------->>>>>>>>>>>>>>>>", data);
let obj = {}
data.forEach((value, index) => {
obj[data[index]['widgetName']] = data[index]
})
yield put(personalizationDataSuccess(obj))
}
catch (error) {
console.log("personalizationDataError----------->>>>>>>>>>>.", error);
personalizationDataError(error)
}
Can anyone please help me with this.
@RahulPant1289 the solution is right above your comment.