You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{createPlugin}from'@promster/hapi'import{createServerascreateMetricsServer}from'@promster/server'importHapifrom'@hapi/hapi'constserver=Hapi.server({port: 4000,host: process.env.HOST,})awaitserver.register(createPlugin())server.route({method: 'GET',path: '/',handler: (request,h)=>{return'hello!'}})awaitserver.start()console.log('Server running on %s',server.info.uri)awaitcreateMetricsServer({port: 4001})console.log(`@promster/server started on port ${process.env.METRICS_PORT}.`)awaitserver.register(createPlugin())
Then 'curl localhost:4000'
TypeError: Cannot read property 'start' of undefined
at Object.onResponseHandler [as listener] (/...../myserver/node_modules/@promster/hapi/modules/plugin/plugin.js:54:40)
Expected behavior
No error and request.promster available in onResponseHandler
Additional context
Running:
hapi.js 18.3.1
@promster/hapi 2.2.4
@promster/server 2.1.1
According to the docs the request-event callback uses the function(request, event, tags) signature rather than (request, h) => {} as in
Turns on server.events.on('request') is only invoked when logging before. There is a GitHub issue where people got confused. Loads of the other internal events are not supported anymore. I went back to use server.ext tested it locally and will publish soon.
Describe the bug
start
in therequest
callback: https://github.com/tdeekens/promster/blob/master/packages/hapi/modules/plugin/plugin.js#L49To Reproduce
Steps to reproduce the behavior:
Expected behavior
request.promster
available inonResponseHandler
Additional context
Running:
18.3.1
@promster/hapi 2.2.4
@promster/server 2.1.1
According to the docs the
request
-event callback uses thefunction(request, event, tags)
signature rather than(request, h) => {}
as inpromster/packages/hapi/modules/plugin/plugin.js
Line 48 in 47a4f1d
According to the docs the
request.plugins
is the place to set things like thepromster
object:onRequestHandler
wouldn't get called on incoming requests.The text was updated successfully, but these errors were encountered: