Comments (8)
Thank you for report. I will check this issue ASAP.
from axios-logger.
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.
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.
from axios-logger.
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.
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.
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.
@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.
@codejamninja
We need to improve this so that we can clearly show errors. Thank you.
from axios-logger.
Related Issues (20)
- baseUrl behavior does not correct HOT 2
- data is stringified even though data is set to false HOT 2
- Release Plan 2.6.1 HOT 1
- 同学,您这个项目引入了556个开源组件,存在6个漏洞,辛苦升级一下 HOT 1
- Axios response intercept not working HOT 1
- Converting circular structure to JSON error with ts-node upgrade HOT 3
- Why should we bind this to a custom logger? it should be the logger object itself right?
- Support axios >= 1.3.0 HOT 13
- URLSearchParams not shown in log HOT 1
- Update library version 3.0.0
- TypeScript complains about .use(AxiosLogger.requestLogger) HOT 14
- Update Jest Version HOT 2
- Support Dual Package HOT 2
- `combineURLs` fails when `baseURL` is a relative path HOT 1
- Option to remove colors HOT 2
- How to log error request body? HOT 2
- `combineURLs` produces wrong absolute URL when `baseURL` has `path` part HOT 3
- V2.8.0 Introduces incompatibilities with web and react native HOT 5
- Axios baseURL is ignored HOT 1
- Release 2.6.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from axios-logger.