Skip to content

Some notes about migration from hapi v16 to v17 #468

@fgalan

Description

@fgalan

Initially on PR #467 I tried to use upgrade to hapi 17 to solve a vulnerability in the old version but at the end it was too hard, so I rolled back to use 16 (fortunatelly, a newer minor of 16 solved also the vulnerability).

However, I get some useful findings that could be useful in the future if this work needs to be done a the end (e.g. an new vulnerability wihtout fix in 16 minor):

  • Change server.on('log', function (event, tags), {...}) to server.events.on('log', function (event, tags) { ... }
  • Change server.on('request-internal', function (request, event, tags) { ... } to server.events.on({ name: 'request', channels: 'internal' }, function(request, event, tags) { ... }.
  • Don't use server.connection(options) function. Instead, use the options object as parameter in the hapi.Server constructor.
  • server.start() doesn't use a callback as parameter any longer. Notes at 17.0.0 Release Notes hapijs/hapi#3658 shows the new patter, based in await. However, I haven't been able to adapt the code using this.

The list is maybe incomplete (I stalled at the last one before giving up)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions