Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined is not an object (evaluating 'e.config') #18906

Open
nicmosc opened this issue Jan 27, 2025 · 0 comments
Open

undefined is not an object (evaluating 'e.config') #18906

nicmosc opened this issue Jan 27, 2025 · 0 comments
Labels
authentication area: authentication, auth, google sign in, password, SAML, password reset, can't log in 🐛 bug Something isn't working

Comments

@nicmosc
Copy link
Contributor

nicmosc commented Jan 27, 2025

Issue Summary

It looks like sometimes the useOAuthFlow hook fails and does not provide more data because the error returned is undefined. Because of the type cast the whole block fails.

Specifically this line:

const originalRequest = err.config as AxiosRequestConfig;

See example from a stacktrace from our own app deployments:

Image

Those traces point to this minified code line:

let e = u && iR.getAuthorizationHeader() ? iR.responseInterceptor.use(void 0, async e => {
                    var n;
                    let u = e.config;
                    if (t && (null == (n = e.response) ? void 0 : n.status) === 498 && !s) {
                        l(!0);
                        let e = await eSe(t);
                        if (e)
                            return c(e),
                            null == a || a(),
                            iR.instance({
                                ...u,
                                headers: {
                                    ...u.headers,
                                    Authorization: `Bearer ${e}`
                                }
                            });
                        null == i || i("Invalid Refresh Token."),
                        l(!1)
                    }
                    return Promise.reject(e.response)
                }
                ) : "";
                return () => {
                    e && iR.responseInterceptor.eject(e)
                }

Which is the code for useOAuthFlow. So clearly, here:

http.responseInterceptor.use(undefined, async (err: AxiosError) => {
            const originalRequest = err.config as AxiosRequestConfig;

The err object is undefined.

Steps to Reproduce

See above

Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?

Actual Results

The refresh token is not properly refreshed as the code fails early, and our error reporting has very little information on the reason.

Expected Results

The refresh token should be refreshed, or at least a Invalid Refresh Token error should throw.

Technical details

  • @calcom/atoms version 1.0.78 but the problematic code is still present on the latest version

Evidence

Image

  • See code snippets above
@nicmosc nicmosc added the 🐛 bug Something isn't working label Jan 27, 2025
@dosubot dosubot bot added the authentication area: authentication, auth, google sign in, password, SAML, password reset, can't log in label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication area: authentication, auth, google sign in, password, SAML, password reset, can't log in 🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant