Hi everybody, I'm currently trying to get the ide...
# support
c
Hi everybody, I'm currently trying to get the identify event to fire in our React Native project. Presently I've created a custom hook and am passing the required values to them. However, for some reason, the identify event does not appear to fire. Moreover, I'm now receiving an error saying:
RudderSDK: Warn: identify : Unsupported argument type passed to identify
I have to admit to being a bit baffled as prior to extracting this particular function to the hook, it worked fine:
Copy code
const identifyUser = async (user: IdentifyProps) => {

    const traits = {
      email: user.email,
      id: user.id,
      uid: user?.uid,
      sid: user?.sid,
    };
    const options = {};

    await rudderClient.identify(user.id, traits, options);

    console.log('IDENTIFY USER',JSON.stringify({ traits, options }, null, 2));
};
Near as I can tell, when I log the data out, I get nothing unusual and my other screen and track events work fine. If any of you could shed a bit of light on what I'm doing wrong here that would be fab. Thanks!
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
h
identify doesnt have options
c
If that is the case, then this documentation may be out of date or incorrect? https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-react-native-sdk/#identify
h
yours is empty which might be causing the issue, the js sdk doesnt have options
just a guess, I dont use react native
c
The RN SDK acts a little weirder than some of the others I guess. When I remove the 3rd param or set it to null, TypeScript throws a wobbly and complains about the screen name
Argument of type 'string' is not assignable to parameter of type 'Record<string, unknown>'.ts(2345)
I'm still a bit fresh off the boat on the TS front, but this gives me the impression it is expecting a 3rd parameter - despite not being explicit about it. I might have to go digging round the source to see if I can figure out what's going on
It looks like it's got 2 type definitions, one for if you're submitting 2 params, and one if you're submitting 3. However, it seems to be the case that if you want to submit two, it must be the last two, not the first two.
Copy code
declare function identify(userId: string, traits: Record<string, unknown>, options: Record<string, unknown>): Promise<void>;
declare function identify(traits: Record<string, unknown>, options: Record<string, unknown>): Promise<void>;
Strange.
c
Hey @chilly-laptop-56953, It seems that the
user.id
field is of integer type. Therefore you’re getting this error. Can you please make sure it is of type
string
or better cast it to string?
c
Hi @calm-yak-10773, thank you that seems to have worked.
🙌 1