Skip to content

process.binding is not supported #1149

@renehauck

Description

@renehauck

Context

  • node version: v6.9.5
  • joi version: ^10.4.1
  • environment : node
  • used with : hapi, nextjs, typescript
  • any other relevant information: server-side rendering

What are you trying to achieve or the steps to reproduce ?

I have this function:

this.server.route({
            method: "POST",
            path: Routes.Login,
                config: {
                   validate: {
                       payload: {
                           email: Joi.string().email().required(),
                           password: Joi.string().min(5).max(100).required(),
                       }
                   },
               },
            handler: (request, reply) => {
               ...
            }
        })

Which result you had ?

when I import "joi" like this:

import * as joi from 'joi'
or
import joi from 'joi'
or
const joi = require('joi');

I get this error:

process.binding is not supported
at Object.process.binding (browser.js?2c72b87:173)
at Object.eval (eval at evalScript (eval-script.js?c3c3587:22), :6779:25)
at Object.893 (eval at evalScript (eval-script.js?c3c3587:22), :6857:30)
at webpack_require (bootstrap 2796216…?8ce1719:693)
at fn (bootstrap 2796216…?8ce1719:110)
at Object.eval (eval at evalScript (eval-script.js?c3c3587:22), :3158:22)
at Object.601 (eval at evalScript (eval-script.js?c3c3587:22), :4753:30)
at webpack_require (bootstrap 2796216…?8ce1719:693)
at fn (bootstrap 2796216…?8ce1719:110)
at Object. (string.js?d42dd4f:5)

it works when I write the validation like this:

...
 config: {
                validate: {
                    payload: {
                        email: require('joi').string().email().required(),
                        password: require('joi').string().min(5).max(100).required()
                    }
                },
            },
...

Is this a bug, or what am I doing wrong?

Thank you 😃

Metadata

Metadata

Assignees

Labels

non issueIssue is not a problem or requires changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions