GithubHelp home page GithubHelp logo

Comments (6)

QuentinFarizon avatar QuentinFarizon commented on May 19, 2024 1

Thanks for your quick reply !

Your sample works, so I will have to disable other plugins and routes to find what's the issue

from cls-rtracer.

QuentinFarizon avatar QuentinFarizon commented on May 19, 2024 1

Turns out it was https://www.npmjs.com/package/hapi-require-https

from cls-rtracer.

puzpuzpuz avatar puzpuzpuz commented on May 19, 2024

The following minimal snippet seems to work fine for me with Hapi 20.2.0 and Node.js v14.17.6:

'use strict';

const Hapi = require('@hapi/hapi');
const rTracer = require('cls-rtracer');

const init = async () => {
    const server = Hapi.server({
        port: 3000,
        host: 'localhost'
    });
    await server.register({
        plugin: rTracer.hapiPlugin
    });

    server.route({
        method: 'GET',
        path: '/',
        handler: (request, h) => {
            const id = rTracer.id()
            return { id };
        }
    });

    await server.start();
    console.log('Server running on %s', server.info.uri);
};

process.on('unhandledRejection', (err) => {
    console.log(err);
    process.exit(1);
});

init();

Could you try it yourself?

from cls-rtracer.

puzpuzpuz avatar puzpuzpuz commented on May 19, 2024

Yes, other plugins may lead to context loss. It makes sense to enable them one by one until you find the problematic one.

from cls-rtracer.

puzpuzpuz avatar puzpuzpuz commented on May 19, 2024

If you were registering that plugin after cls-rtracer, moving it up may fix the issue. If it's already registered before cls-rtracer, I'm afraid that the only way would be to debug it (or replace it with another similar plugin, if any exist).

from cls-rtracer.

puzpuzpuz avatar puzpuzpuz commented on May 19, 2024

Closing this one as the reason was found.

from cls-rtracer.

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.