Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined is not an object (evaluating Transform.call') React Native #26

Open
parth-choudhary opened this issue Feb 28, 2020 · 5 comments

Comments

@parth-choudhary
Copy link

Getting this error in react-native using crypto-browserify.

Have setup .babelrc like this:

"plugins": [ ["babel-plugin-rewrite-require", { aliases: { crypto: 'crypto-browserify', } }]

@tarungomile
Copy link

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' } } ] ]
};

@fiatjaf
Copy link

fiatjaf commented Dec 11, 2021

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.

@fiatjaf
Copy link

fiatjaf commented Dec 11, 2021

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 browserify/cipher-base#10 (comment), for example.

@RahulPant1289
Copy link

RahulPant1289 commented Oct 19, 2022

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.

@fiatjaf
Copy link

fiatjaf commented Oct 19, 2022

@RahulPant1289 the solution is right above your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants