i18next/i18next-http-middleware

"no possibility found to get query" log

gtolarc opened this issue · 9 comments

I am using fastify from nextjs to custom server, and the following error log is left on every request. There seems to be no problem in functionality, but I think the log is unnecessary. Can you get rid of it?

{"level":30,"time":1591688347572,"pid":30,"hostname":"xxx","reqId":176,"req":{"method":"GET","url":"/health","hostname":"172.20.0.11:3000","remoteAddress":"10.0.0.249","remotePort":53040},"msg":"incoming request"}
no possibility found to get query
no possibility found to get query
{"level":30,"time":1591688347576,"pid":30,"hostname":"xxx","reqId":176,"res":{"statusCode":200},"responseTime":3.8200836181640625,"msg":"request completed"}
adrai commented

This log statements indicates the developer that maybe something is wrong...
I can't reproduce this with this example: https://github.com/i18next/i18next-http-middleware/tree/master/example/fastify
Can you create a reproducable example?

It is probably a problem that occurs when used with next-i18next.

const fastify = require('fastify');
const next = require('next');
const NextI18Next = require('next-i18next').default;
const nextI18NextMiddleware = require('next-i18next/middleware').default;

const nextI18next = new NextI18Next({ otherLanguages: ['de'] });

const app = next({ dev: true });
const server = fastify();

(async () => {
  await app.prepare();
  server.register(async (instance, options, callback) => {
    const handle = app.getRequestHandler();
    await nextI18next.initPromise;
    instance.use(nextI18NextMiddleware(nextI18next));
    instance.get('/*', (request, reply) => {
      handle(request.req, reply.res);
    });
    callback();
  });

  await server.ready();
  server.listen(3000, '0.0.0.0', (err) => {
    if (err) {
      server.log.error(err);
      process.exit(1);
    }
  });
})();

It seems to occur when a request comes in through curl or programming request rather than a browser request. In my case, the log is generated whenever a health check request comes in on aws. Even in your example, curl generates a log.

curl -X GET http://localhost:3000

adrai commented

I see...
Just released a new version to handle also this case... v2.1.1
Can you try?

It seems solved. Thank you.

adrai commented

If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project.

There are many ways to help this project 🙏

@adrai Hello, I hope its a good place to ask something else, cuz this is the only place on the internet what phrase no possibility found to get, exists ;)

Using this framework in our project but still not sure if it is source of problem.

Are you familar with this?
here sentry issue:
image

headers : {
accept: text/html,application/xml;q=0.9,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5, 
accept-charset: utf-8,ISO-8859-1;q=0.7,*;q=0.7, 
accept-encoding: x-gzip, gzip, deflate, 
accept-language: en-us,en-gb,en;q=0.7,*;q=0.3, 
connection: upgrade, 
cookie: next-i18next=en, 
host: www.inksearch.co, 
user-agent: ZoominfoBot (zoominfobot at zoominfo dot com), 
x-forwarded-for: 35.237.106.8, 
x-nginx-proxy: true,
}
}
adrai commented

@7sleepwalker sorry, not familiar with sentry, for questions, please ask at stackoverflow or similar
If you have an issue with a simple reproducable example, create an issue or even better a PR.