devrnt / react-use-intercom

☎️ React Intercom integration without the hassle, powered by hooks.
https://devrnt.github.io/react-use-intercom/#/useIntercom
MIT License
337 stars 43 forks source link

Warning about app id but Intercom works as intended #673

Closed johanbook closed 5 months ago

johanbook commented 5 months ago

Describe the bug The warning below shows for us in production despite Intercom working as intended (and app id is supplied in the provder).

Screenshot 2024-05-27 at 09 16 54

We set up our provider like this

    <IntercomProvider appId={import.meta.env.VITE_INTERCOM_APP_ID}>
    ...
    </IntercomProvider>

We initialize Intercom like this

const useDDIntercom = () => {
  const { boot, shutdown } = useIntercom();
  const { profileData, hasProfileData } = getProfile()

  useEffect(() => {
    if (!hasProfileData || !import.meta.env.PROD) {
      return;
    }

    const initializeIntercom = (userHash: string | undefined) => {
      try {
        boot({ email: profileData.email, userHash });
      } catch (err) {
        Logger.captureException(err, {
          message: "Intercom has encountered an error to initialize."
        });
      }
    };

    getIntercomHash()
      .then(({ data }) => initializeIntercom(data))
      .catch(error =>
        Logger.captureException(error, {
          message: "Error setting up Intercom. HMAC wasn't generated."
        })
      );

    return () => {
      shutdown();
    };
  }, [hasProfileData, profileData.email]);
};

export default useDDIntercom;

To Reproduce

Codesandbox link

Expected behavior Not see the warning.

Screenshots See above.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

devrnt commented 5 months ago

This is weird indeed. Seems like a warning from Intercom itself, have you tried asking on the Intercom Forum?

I won't consider this as an issue of this library. Feel free to re-open if you can provide a reproduction, so I can further investigate it.