Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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.
    AmandHellen
    @AmandHellen
    Someone can help me ? I have a payload stream, but i cant take the data of this payload
    Someone know how can i do this ?
    Cem Basaranoglu
    @cem-basaranoglu
    pals, I have an awkward error. I'm working on a legacy project and I got this error most of the time. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
    TypeError: msg.socket.cork is not a function what do u think? node version: 14.16 hapi version: 17.8.1
    Ario K
    @itsario_twitter
    anyone have any idea what Joi validation I can use to accept any type of json string object?
    I upgrade Joi and now Joi.object().optional() doesn't work
    SK-FComputer
    @SK-FComputer
    Is there any way to rewrite the request headers in the lifecycle hook pre or ext ?
    application/xml fails if parse is true (default) for route
    Roy Keene
    @rkeene
    I'm trying to use Lab to do some testing. Defining the tests requires an async function to run, which will return the list of things to test. But it's not clear how to make that work with Lab.
    Juan Gauna
    @jgauna
    Hi there. Does anyone know how to use Glue with server.methods?
    Saquib
    @iamsaquib8
    Is there any gist or documentation on how to implement server-sent events(SSE) on the Hapi side?
    enakann
    @enakann

    since I could set one cookie using (request.cookieAuth.set(data1)), setting one more data makes it more than 4k.

    I wanted to set 1 more cookie so , I did
    return reply.redirect(nextPath).state('data2', data2);
    but for some users , its not being set , could someone help me with this pls.