Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Orlando Quero
    @orlaqp
    I found my problem, in case somebody runs into the same issue this is how you solve it. You need to import it like this: import * as J from '@hapi/joi';
    Ghost
    @ghost~5ebbe298d73408ce4fe39bc2
    Hi!! Does anyone have use Supertest with Hapi?
    Ghost
    @ghost~5ebbe298d73408ce4fe39bc2
    Hello?
    Or anyone has some documentation about Continuous Integration Pipelines in Jenkins using Lab + Code for the testing?
    Ryan Wilson
    @Icehunter
    Hi! I'm using typescript with Hapi; and I want to augment the ServerApplicationState object globally. I've setup @types, custom types, etc and nothing is loaded by vscode. Is there a concrete example of something like this out in the wild? I can't find anything so far.
    AndrewMerke
    @AndrewMerke
    Hello, guys I have a question about server methods
    let refreshData = function () {
        server.methods
          .search(deepCopy(AllProjectsQuery.query), null, "USE_CACHE")
          .then((data) => {
            logger.log('info', 'refresh all projects data succeed')
          })
          .catch((err) => {
            logger.log('error', 'refresh all projects data error: %s', JSON.stringify(err))
          })
      }
    it says server.methods.search is not a function
    Currently I am migrating from v16 to v18, all seems to be working except this part. Maybe someone could give me a hint what is wrong?
    Peeter Tomberg
    @peeter-tomberg
    Hey guys!
    Any idea on how I can enable streaming HTTP respones in Hapi?
    I tried hapijs/hapi#3599 but no success
    I've also tried removing compression (in server flags pass compression false) and then streaming but it all still gets sent in a single chunk
    eswarmdv
    @eswarmdv
    Hi
    Can any one Please help me to set HTTP response headers in Hapi ?
    For file downloads(CSV/TEXT)
    corentin
    @corenti13711539_twitter
    Hi, I'd need to implement catchall OPTIONS -method handling for a HAPI v19 based development server. What would be the simplest and least disruptive way to implement this? I was thinking of implementing a HTTP 404 handler that would check if it was an OPTIONS request and basically just turn the response into HTTP 200. I'm new to HAPI, so advice and/or pointers would be welcome. Also, I'd prefer to avoid adding new modules if possible. Any thoughts?
    corentin
    @corenti13711539_twitter
    Ok - I was able to implement a plugin for this, but would appreciate any pointers if there's a better / simpler way to do this.
    Anyone able to help me on how to get HAPI to generate CORS headers? access-control-allow-origin et al. are working ok, but how do I configure Access-Control-Allow-Methods? I'm currently generating *-methods header in my plugin, but just I'd prefer to use HAPI CORS config for this if possible.
    Fernando Ontiveros
    @ferOnti
    hi, I used hapi/nes for a web socket projects some years ago, but now I'm back, and can't make it work with latest version of @hapi and @hapi/nes and the browser as a client.
    can any of you point me to the right direction to make it work a simple web browser connect to @hapi/nes
    Fernando Ontiveros
    @ferOnti
    nevermind, I figure it out
    carolinee21
    @carolinee21
    Hi, is the hapi hour slack no longer active? It seems the link on the website is broken
    Gerson Gallo
    @ggallovalle
    hapihour.slack.com
    carolinee21
    @carolinee21
    thanks @ggallovalle! I was looking actually for a link to join the slack - for that direct link you need to already be on the slack for it to work, and the joining link on the website is expired
    Nav Saini
    @navxio
    Hi all! How do I introduce same-site: None to my hapi 15.x app?
    (SameSite: None) cookie
    fcesgpfedef
    @fcesgpfedef
    Hi Friends, In hapi 19 does anyone knows how to pass parameter "config" in the route
    fcesgpfedef
    @fcesgpfedef
    We upgraded from hapi-15 to hapi-19 recently . As part of upgrade, hapi-swagger got updated from 7.8.1 to 13.0.2, now we are seeing hapi-swagger-UI is completely removed with new version. Can anyone suggest on how to go with this.
    "<script src='{{hapiSwagger.swaggerUIPath}}lib/jquery-1.8.0.min.js' type='text/javascript'></script>" This is giving 404 in hapi-swagger 13.x which was working perfectly fine in hapi-swagger 7.x
    Daniel Ji
    @epikhighs
    for cached server methods (aka catbox caching) has anyone tried to use the pendingGenerateTimeout property? No matter what value I set or not defining it, I can't seem to get concurrent access to a cache item working. It always queues it up and the same object is returned. Here's the sample code. I try to access /route1 and then wait a few seconds then access /route2, but they both return the same exact item. I would expect that since there is no cached item initially, that the calls to /route1 and /route2 should return different objects?
      function sleep(ms) {
        return new Promise((resolve) => {
          setTimeout(resolve, ms);
        });
      }
    
      const querySchemaMetadata = async () => {
        console.log(`regenerating cache ${(new Date()).toLocaleTimeString()}`);
        await sleep(9000);
        return Promise.resolve([{id: `${(new Date()).getMilliseconds()}`}]);
      };
      server.method('querySchemaMetadata', querySchemaMetadata, {
        cache: {
          expiresIn: 60 * 60 * 1000,  // 1hr
          /**
           * provides a 15 second timeout querySchemaMetadata to return. Otherwise, returns a timeout error
           */
          generateTimeout: false,
          //generateTimeout: 15 * 1000,
          /**
           * returns a wrapped object of the value that includes additional stats metadata
           */
          getDecoratedValue: true,
          /**
           * allow multiple simultaneous access requests to this cache item to be queued for up to a duration of
           * 10 seconds before a separate access request is allowed.
           */
          pendingGenerateTimeout: 2000,
        }
      });
    
      server.route({
        path: '/route1',
        method: 'GET',
        handler: async function (request, h) {
          await server.methods.querySchemaMetadata()
        }
      });
    
      server.route({
        path: '/route2',
        method: 'GET',
        handler: async function (request, h) {
          await server.methods.querySchemaMetadata();
        }
      });
    Ario K
    @itsario_twitter
    I'm trying to pass a JSON string in a get request
    when recieve, do a JSON.parse
    However, I cannot access the properties inside after JSON.parse
    via a Joi.string().optional() validation
    Feder
    @fchpr
    o/
    is there anything else needed to make a GET from the browser into hapi besides cors: true ?
    what i'm doing is:
    ...
    const server = Hapi.server({
      port: 9000,
      host: 'localhost',
      routes: {
        cors: true
       }
    });
    server.route({
      method: 'GET',
      path: '/',
      handler: (request, h) => {
        return 'Hello World!';
      }
    });
    ...
    and I can see the response body with curl or httpie, but from browser (tested with svelte and react apps) just got the following:
    Response {type: "cors", url: "http://localhost:9000/", redirected: false, status: 200, ok: true, …}
    body: (...)
    bodyUsed: false
    headers: Headers {}
    ok: true
    redirected: false
    status: 200
    statusText: "OK"
    type: "cors"
    url: "http://localhost:9000/"
    __proto__: Response
    without any response body... anyway
    regards,
    Matthew Adams
    @matthewadams
    How do I match multiple parameters in a route, like /providers/{providerId}/fulfillers/{fulfillerId}/customers/{customerId}? https://hapi.dev/api/?v=20.0.3#path-parameters says hapi can only match one. Do I really have to use /providers/{things*} then do something like things.split('/')? Seems like a burden.
    devin ivy
    @devinivy
    hello, member of the hapi technical steering committee here :wave: just wanted to share with those here that there is an official hapi slack. please join us, it's pretty lively over there :) https://join.slack.com/t/hapihour/shared_invite/zt-g5ortpsk-ErlnRA2rUcPIWES21oXBOg
    Megha Modi
    @meghamodi
    Screen Shot 2021-02-03 at 1.17.10 PM.png
    Hi, I am unable to get the results on HTML page from the SQL query I am using. I am not sure what I am doing wrong in this piece of code.
    fcesgpfedef
    @fcesgpfedef
    Anyone knows how to log responseBody in hapi-pino. Google is telling to use serializers but i am not able to find right example on how to use serializer and log responseBody
    enakann
    @enakann
    Is it possible to set more than one cookie in hapi-auth-cookie using
    request.cookieAuth.set() ??
    Roy Keene
    @rkeene
    cookieAuth.set() sets the data within the cookie, usually to some kind of object. The cookie is encrypted and sent to the client.