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

this.request is not a function #4944

Closed
rizaldirnm opened this issue Sep 6, 2022 · 0 comments
Closed

this.request is not a function #4944

rizaldirnm opened this issue Sep 6, 2022 · 0 comments

Comments

@rizaldirnm
Copy link

Describe the bug

I got receive error report from Sentry.

CleanShot 2022-09-06 at 08 33 34@2x

I have no idea what is this.

the function in core/http/http.ts looks like:

export const apiInstance = axios.create({
  timeout: API_TIMEOUT,
  baseURL: BASE_URL,
});


/**
 * handle HTTP GET to RestAPI
 */
export const get = <T = any>(
  endpoint: string,
  queryParam: any = {},
  config?: AxiosRequestConfig
) => {
  /**
   * Url endpoint
   */
  let url = endpoint;
  /**
   * Add query param when `queryParam` is given
   */
  if (queryParam && Object.keys(queryParam).length > 0) {
    url = url + '?' + serializeParam(queryParam);
  }

  const newConfig: AxiosRequestConfig = {
    // attach config from param function
    ...config,
    headers: {
      ...config?.headers,
      'content-type': 'application/json',
    },
  };

  return apiInstance.get<T>(url, newConfig);
};

Up until now only 1 event occur in sentry. Is it possible error from axios lib? Or something wrong with my implementation?

To Reproduce

Its so rare, I cant even reproduce it.

Expected behavior

Sentry should not showing an error.

Environment

  • Axios Version 0.27.2
  • Browser Chrome Mobile WebView 104.0.5112
  • Browser Version 104.0.5112
  • OS: Android 7.1.1
  • Device: SAMSUNG SM-J250F

Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants