OneSignal/react-onesignal

[Bug]: setExternalUserId never resolve

aivils opened this issue · 5 comments

What happened?

  return OneSignal.setExternalUserId(userId).then(res => {
    console.log('setOneSignalExternalUserId never reach');
  }).catch(err => {
    console.log('setOneSignalExternalUserId never reach');
  });

Steps to reproduce?

1. install 'react-onesignal'
2. write code above

What did you expect to happen?

I expect the "setExternalUserId" function to return a Promise that will call "resolve" or "reject" after a time.

Relevant log output

No response

Howdy,
Can you provide a little bit more of your code? How are you initializing OneSignal?

I think the initialization is fully in line with the documentation.

export const ClientApp = props => {
  const { store } = props;
  setupLocale();
  useEffect(() => {
    initOneSignal();
  });
  return (
      <Provider store={store}>
        <HelmetProvider>
          <IncludeMapLibraryScripts />
          <BrowserRouter>
            <Routes routes={routeConfiguration()} />
          </BrowserRouter>
        </HelmetProvider>
      </Provider>
  );
};

import OneSignal from 'react-onesignal';

export const initOneSignal = async () => {
  await OneSignal.init({
    appId: config.onesignal.appId,
    safari_web_id: config.onesignal.safari_web_id,
    notifyButton: {
      enable: true,
    },
    subdomainName: config.onesignal.subdomainName,
    allowLocalhostAsSecureOrigin: config.dev,
    serviceWorkerParam: { scope: '/static/scripts/onesignal/' },
    serviceWorkerPath: 'static/scripts/onesignal/OneSignalSDKWorker.js',
  });
  OneSignal.showSlidedownPrompt();
};

export const setOneSignalExternalUserId = user => {
  const userId = user.id.uuid;
  return OneSignal.setExternalUserId(userId).then(res => {
    console.log('setOneSignalExternalUserId never reach');
  }).catch(err => {
    console.log('setOneSignalExternalUserId never reach');
  });
};

I have not tested all the proposed functions, but I suspect that the "react-onesignal" library has several documentation-compliant functions OneSignal.doSomething() that return a Promise, but the Promise is not resolved.

This does not mean that OneSignal does not work. The meaning of this message is that the result of the OneSignal function cannot be verified.

Howdy,
Apologies for the delay. Were you able to resolve this issue?

In other news, we are preparing the major release as part of our shift to a user-centered model with a brand new api. Keep an eye out for that also!

Closing due to no response

same issue it is not being resolved.