arthemiumA
Denoβ€’3y agoβ€’
1 reply
arthemium

npm:axios not returning anything

I'm trying to troubleshoot a problem with axios (the same snippet works fine on node).

I'm calling axios.request , however, it doesn't return anything and doesn't throw any errors.

The sequence only get's to print axios request, however, doesn't progress further.

importing axios 1.4.0

try {
      console.log("axios request");
      const axiosRes = await axios.request({
        url: `${this.baseUri}/${path}${
          options.searchParams ? `?${options.searchParams.toString()}` : ''
        }`,
        headers: this.headers.concat(options.headers || {}),
        method: options.method,
        onUploadProgress: options.onUploadProgress,
        data: options.body,
      });
      console.log("AXIOS RESPONSE")
      console.log(axiosRes)
      return {
        headers: axiosRes.headers as any,
        body: JSON.stringify(axiosRes.data),
      };
    } catch (error: any) {
      console.log("ERRROOROR")
      const axiosError = error as AxiosError;
      throw new ApiVideoError(
        axiosError.response?.status || 0,
        axiosError.response?.data as ProblemDetails
      );
    }
  }
Was this page helpful?