Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Brandon Caruana
    @caruana
    Google is not helping much so I thought I turn to Gitter
    Tõnis Ostrat
    @tonisostrat
    import * as Hapi from 'hapi';
    Brandon Caruana
    @caruana
    @tonisostrat I tried that "Error: Cannot find module 'hapi'
    my package.json dependencies ref is: "@hapi/hapi": "^18.3.2"
    Tõnis Ostrat
    @tonisostrat
    what about @types/hapi?
    Brandon Caruana
    @caruana
    yes, I have "@types/hapi": "^18.0.2",
    I pruned @hapi/hapi out and changed to hapi: ^18.0.2 (this jus worked)
    Tõnis Ostrat
    @tonisostrat
    ah, ok. i guess they've changed their project structure and the typings don't reflect that
    Brandon Caruana
    @caruana
    But i'm unclear on why @hapi/hapi doesn't (maybe the @types is not up to date)
    @tonisostrat ok, i'm guessing the same, thanks for the direction
    Brandon Caruana
    @caruana
    for anyone looking @hapi/hapi ^18.3.2 requires @types/hapi__hapi ^18.0.2
    Ben Chiciudean
    @benydc
    is it possible to provide default headers when using inject?
    Sitraka Ratsimba
    @sitraka-hq

    Hi! I'm not sure if it is a bug

    I'm using "@hapi/hapi": "^18.3.2", "@hapi/joi": "^16.0.1",

    My routes looks like:

    'use strict';
    
    const Joi = require('@hapi/joi');
    
    module.exports = [
        {
            method: 'GET',
            path: '/users/new',
            handler: (request, h) => {
    
                return h.view('users/new');
            }
        },
        {
            method: 'POST',
            path: '/users',
            handler: (request, h) => {
    
                return h.view('users/new');
            },
            options: {
                validate: {
                    payload: Joi.object().keys({
                        username: Joi.string()
                    })
                }
            }
        }
    ];

    I get the following error when I start the server:

     Error: Invalid schema content: ($_root.alternatives)
        at new module.exports (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hoek/lib/error.js:21:15)
        at Object.module.exports [as assert] (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hoek/lib/assert.js:20:11)
        at Object.exports.schema (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/node_modules/@hapi/joi/lib/cast.js:50:10)
        at internals.Object.keys (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/node_modules/@hapi/joi/lib/types/object/index.js:363:35)
        at Object.exports.schema (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/node_modules/@hapi/joi/lib/cast.js:31:29)
        at internals.Object.keys (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/node_modules/@hapi/joi/lib/types/object/index.js:363:35)
        at Object.exports.schema (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/node_modules/@hapi/joi/lib/cast.js:31:29)
        at module.exports.internals.Any.root.compile (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/node_modules/@hapi/joi/lib/index.js:157:25)
        at Object.exports.compile (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/lib/validation.js:21:49)
        at forEach (/home/sitraka/Projects/camoicenter/node_modules/@hapi/hapi/lib/route.js:196:43) path: '$_root.alternatives' }
    Sitraka Ratsimba
    @sitraka-hq
    @sitraka-hq hapijs/joi#2107
    Yoann MALLEMANCHE
    @YoannMa
    Joi already support trimming string and stripNullorEmpty IIRC
    Kan Yilmaz
    @thellimist
    Hi, I'm the founder of Kodem.io - Node.js deployments with no fancy configuration or modification. I'm mostly looking into hapijs out of personal interest. Thanks
    A
    @ybitso

    im having hard time finding good documentation on how to setup ssl
    this is what I have

        const server = hapi.server({
            port: port,
            host: configs.APIServer[env].Hostname,
            routes: {
                cors: {
                    origin: [configs.APIServer[env].Protocol +
                        "://" +
                        configs.WebServer[env].Hostname +
                        ":" +
                        configs.WebServer[env].Port, configs.WebServer[env].Protocol +
                        "://" +
                        configs.WebServer[env].IP +
                        ":" +
                    configs.WebServer[env].Port
                    ]
                }
            }
            // ,debug: {
            //     request: env === "production" ? ["error"] : ["error", "debug"]
            // }
        })

    do i just need to add on the bottom:

    , {
            tls: ssloptions
        }

    where ssloptions is the certs

    Will Hoover
    @ugate
    Does anyone know how to get details for @hapi/lab error: "The following leaks were detected:globalThis"? There doesn't seem to be any other output that indicates where the leak is occurring?
    Yoann MALLEMANCHE
    @YoannMa
    It can't find the leak for you sadly, most of the time it's from a library you are using
    Will Hoover
    @ugate
    That is disappointing :( I'm not sure how useful the option to detect leaks is if there isn't a straight forward path to resolve it
    Yoann MALLEMANCHE
    @YoannMa
    If you want, you can ignore this leak
    -I, --ignore - ignore a list of globals for the leak detection (comma separated), this is an alias of globals property in .labrc file. To ignore symbols, pass the symbol's string representation (e.g. Symbol(special)).
    Will Hoover
    @ugate
    That may be what I'll do if I can't find the cause of the leak. Thanks for the feedback @YoannMa !
    Yoann MALLEMANCHE
    @YoannMa
    It's not like you got much choice anyway, if you use Sentry for example, the library set a global __SENTRY__ so you need to ignore it....
    Will Hoover
    @ugate
    Good point!
    Will Hoover
    @ugate
    @YoannMa it looks like @hapi/lab has some issues with Node v12. I ran the same tests under Node v11 and no global leaks were detected, but when I run the same tests in Node v12 I get "The following leaks were detected:globalThis"
    Ben Chiciudean
    @benydc
    is there a API versioning for 18?
    so I can version my routes
    Yoann MALLEMANCHE
    @YoannMa
    There are plugin for it, but Hapi does not support it out of the box I believe
    Ben Chiciudean
    @benydc
    ahh, was looking for an out of the box support, I will check the plugin
    thanks
    Yoann MALLEMANCHE
    @YoannMa
    IMO, Hapi won't ever support api versioning out of the box
    CragVFX
    @CragVFX
    Does anyone know where I can find the hapi docs for v15? It appears like the site only goes back to 16.8 and I need to make a change to a v15 legacy route
    Tõnis Ostrat
    @tonisostrat
    you can choose a different tag depending on the specific version
    CragVFX
    @CragVFX
    @tonisostrat thanks thats what I was looking for 😀
    ahnsj17
    @ahnsj17
    @tonisostrat Hi there :)