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
I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
Throw a well described exception if serverPlugin is not defined (node_modules/fastify-cli/util.js, requireServerPluginFromPath)
Motivation
Hi team,
I had followed Getting Started docs page, copied the code from 'You First Server' section and then used command to run a server from 'Run Your Server From CLI' section. The execution failed with the following exception:
TypeError: Cannot read properties of undefined (reading 'length')
at isInvalidAsyncPlugin (/Users/mbelsky/gh/xox-mm/node_modules/fastify-cli/util.js:45:17)
at requireServerPluginFromPath (/Users/mbelsky/gh/xox-mm/node_modules/fastify-cli/util.js:84:7)
at async runFastify (/Users/mbelsky/gh/xox-mm/node_modules/fastify-cli/start.js:90:12)
Then it took me some time to realize the start file must have an exported plugin. "fastify-cli" package version: 5.7.1
I believe adding a well described exception throw can help other users to spot the issue faster. If you find the proposal useful I'd like to implement it.
Example
if (!serverPlugin) {
throw new Error(`${resolvedModulePath} does not export a plugin function`)
}
The text was updated successfully, but these errors were encountered:
Prerequisites
🚀 Feature Proposal
Throw a well described exception if
serverPlugin
is not defined (node_modules/fastify-cli/util.js, requireServerPluginFromPath)Motivation
Hi team,
I had followed Getting Started docs page, copied the code from 'You First Server' section and then used command to run a server from 'Run Your Server From CLI' section. The execution failed with the following exception:
Then it took me some time to realize the start file must have an exported plugin. "fastify-cli" package version: 5.7.1
I believe adding a well described exception throw can help other users to spot the issue faster. If you find the proposal useful I'd like to implement it.
Example
The text was updated successfully, but these errors were encountered: