Giter Site home page Giter Site logo

Comments (8)

hg-pyun avatar hg-pyun commented on June 14, 2024 1

Thank you for report. I will check this issue ASAP.

from axios-logger.

hg-pyun avatar hg-pyun commented on June 14, 2024
import axios from "axios";
import { requestLogger, responseLogger, errorLogger } from "axios-logger";
const API_URL = "https://y2iuo.csb.app/123";
const api = axios.create({
  baseURL: API_URL,
  method: "post"
});

api.interceptors.request.use(requestLogger, errorLogger);
api.interceptors.response.use(responseLogger, errorLogger);

// Request
async function get() {
  const { data } = await api.post(`/123`, {});
  return data;
}
get();

I test with above code. But works well. It maybe another issue.
Here are sandbox test code. https://codesandbox.io/s/axios-logger-issue-50-y2iuo

Please check your business logic. If there is no problem after checking, please contact me again. I would appreciate it if you could give us the code reproduced at jsfiddle or sandbox.io.

Thank you.

from axios-logger.

BobFactory avatar BobFactory commented on June 14, 2024

Hi @hg-pyun , firstly this lib great and i appreciate what you have done up until now, Thank you.
I have a similar issue where the entire url is not being shown in the console when using this lib.
We only get the api end point that is being used. I tried you codesandbox example as well and it was showing the same response for me.

what I expect to see is that when I use the above I want to see this in the log.
[API Call][Error] 01:05:48 https://y2iuo.csb.app/123 POST {}.
But instead what we see is this.
[Axios][Error] 01:05:48 /123 POST {}

I have the screen shot as well for this.
Screenshot 2020-05-30 at 1 16 10 PM

from axios-logger.

clayrisser avatar clayrisser commented on June 14, 2024

I am getting a similar error.

Cannot read property 'url' of undefined
[Nest] 186837   - 2020-05-30 10:04:07 PM   [ExceptionsHandler] Cannot read property 'url' of undefined +7094ms
TypeError: Cannot read property 'url' of undefined
    at errorLoggerWithoutPromise (/home/codejamninja/Projects/appsaas-core/node_modules/.pnpm/registry.npmjs.org/axios-logger/2.3.1/node_modules/axios-logger/lib/logger/error.js:20:7)
    at Object.errorLogger (/home/codejamninja/Projects/appsaas-core/node_modules/.pnpm/registry.npmjs.org/axios-logger/2.3.1/node_modules/axios-logger/lib/logger/error.js:42:25)
    at /home/codejamninja/Projects/appsaas-core/dist/0.f29eba7e5230f77ce51a.hot-update.js:29:138
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async AuthService.authenticate (/home/codejamninja/Projects/appsaas-core/dist/0.dd97e155f6512bf42957.hot-update.js:66:29)
    at async AuthController.postLogin (/home/codejamninja/Projects/appsaas-core/dist/0.a729b615aa20c66bea92.hot-update.js:38:32)
    at async /home/codejamninja/Projects/appsaas-core/node_modules/.pnpm/registry.npmjs.org/@nestjs/core/7.1.1_59c22b4ffbdfb1e3406b39779023abf5/node_modules/@nestjs/core/router/router-execution-context.js:45:28
    at async /home/codejamninja/Projects/appsaas-core/node_modules/.pnpm/registry.npmjs.org/@nestjs/core/7.1.1_59c22b4ffbdfb1e3406b39779023abf5/node_modules/@nestjs/core/router/router-proxy.js:8:17
    at async /home/codejamninja/Projects/appsaas-core/node_modules/.pnpm/registry.npmjs.org/@nestjs/core/7.1.1_59c22b4ffbdfb1e3406b39779023abf5/node_modules/@nestjs/core/router/router-explorer.js:137:17

from axios-logger.

clayrisser avatar clayrisser commented on June 14, 2024

It looks like it is coming from this line.

https://github.com/hg-pyun/axios-logger/blob/master/src/logger/error.ts#L9

from axios-logger.

clayrisser avatar clayrisser commented on June 14, 2024

Ok, I just had to pass the config to the errorLogger. Weird, because the typescript definition for error logger does not have config.

from axios-logger.

hg-pyun avatar hg-pyun commented on June 14, 2024

@BobFactory
Thank you for the report. I've confirmed that it's reproduced. I will check the reason and give you a comment.

from axios-logger.

hg-pyun avatar hg-pyun commented on June 14, 2024

@codejamninja
We need to improve this so that we can clearly show errors. Thank you.

from axios-logger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.