Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server options load support? Migrating from hapi 16 -> 17 #123

Closed
eitah opened this issue Jan 4, 2019 · 6 comments
Closed

Server options load support? Migrating from hapi 16 -> 17 #123

eitah opened this issue Jan 4, 2019 · 6 comments
Assignees
Labels
support Questions, discussions, and general support

Comments

@eitah
Copy link

eitah commented Jan 4, 2019

I'm migrating from hapi 16 -> 17.

I see the new syntax for passing load options in hapi is to pass server.options.load (example max event loop delay as documented here https://github.com/hapijs/hapi/blob/master/API.md#-serveroptionsload). The docs above label it as the Hapi api for v18.x but since that’s the development version I think the settings are identical for v17 as per the release notes here hapijs/hapi#3658

But when i try to pass those in my manifest options the Joi schema dings me for not being one of the options below. would there be plans to include additional happy config options in glue eventually? Or how would you recommend I pass options to the hapi Server outside of those supported by glue?

We're on node 8 and Express if that matters.
Thanks,
Eli

relativeTo: Joi.string(),
preRegister: Joi.func().allow(false)
@csrl csrl added the question label Jan 4, 2019
@csrl
Copy link
Contributor

csrl commented Jan 4, 2019

Server options go into manifest.server, not glue compose options. If that is what you are doing, then please provide example code that fails.

@eitah
Copy link
Author

eitah commented Jan 4, 2019

I am following along with the example usage here https://github.com/hapijs/glue/blob/master/API.md#usage

that code abstracts away access to the call to this code so that I never write the line
const server = Hapi.server({ cache: [{ engine: require('redis') }], port: 8000 });

I dont understand how to access the Hapi.server options object to pass additional options if glue compose returns an instance of a server already prepared.

@eitah
Copy link
Author

eitah commented Jan 4, 2019

To be specific about my code, i am passing manifest with the below options, and Hapi complains that they are not valid

const manifest = { server: { maxHeapUsedBytes: 1073741824, load: { sampleInterval: 1000, }, }, };

The error I receive is
[1] "maxHeapUsedBytes" is not allowed at [relative path]/node_modules/hapi/lib/config.js:22:10)

If it matters sine hapi is complaining I am on version hapi@^17.8.1

@csrl
Copy link
Contributor

csrl commented Jan 4, 2019

Does it work with calling Hapi.server({ load: { sampleInterval: 1000, maxHeapUsedBytes: 1073741824, }, }) directly? As you show, the error comes from hapi, not glue.

@eitah
Copy link
Author

eitah commented Jan 4, 2019

that did it! thank you for the correction. I merely had the options object configured incorrectly. The heap should have been inside the load object not outside it.
Thanks again.

@eitah eitah closed this as completed Jan 4, 2019
@csrl csrl self-assigned this Jan 4, 2019
@Marsup Marsup added support Questions, discussions, and general support and removed question labels Sep 21, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

3 participants