Skip to content

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

Description

@parth-choudhary

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

Have setup .babelrc like this:

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

Activity

  1. tarungomile commented on Feb 15, 2021

    @tarungomile

    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' } } ] ]
    };
    
    
  2. fiatjaf commented on Dec 11, 2021

    @fiatjaf

    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.

  3. fiatjaf commented on Dec 11, 2021

    @fiatjaf

    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.

  4. RahulPant1289 commented on Oct 19, 2022

    @RahulPant1289

    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.

  5. fiatjaf commented on Oct 19, 2022

    @fiatjaf

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions