When we use a custom form with code, and calling register API as a click callback, the signup
request itself succeeds, and new member account is created successfully, but there is a runtime error on JavaScript saying Cannot read properties of undefined
. This prevents us from proceeding post-registration callbacks such as notifications.
workerLogger.js:103 Cannot read properties of undefined (reading 'status')
(anonymous) @ workerLogger.js:103
(anonymous) @ siteMembersSdkFactory.ts:223
(anonymous) @ tslib.es6.js:102
(anonymous) @ tslib.es6.js:83
a @ tslib.es6.js:73
Promise.then (async)
it seems the error comes from the code below in siteMembersSdkFactory.ts.
const data = options?.recaptchaToken
? await register(email, password, options)
: await withCaptchaChallengeHandler((recaptchaToken) =>
register(email, password, { ...(options || {}), recaptchaToken })
)
const response = {
status: data.status,
...(data.approvalToken ? { approvalToken: data.approvalToken } : {}),
}
Is this a bug from SDK, or is there a way to avoid this error?
Thanks in advance. Tom