tinyhttp doesn't work as server for Next.js
See original GitHub issueDescribe the bug
I often use Next.js framework. It commonly used with Express server. I’ve got an idea to try tinyhttp for my projects (and also to add an example to Next.js repo). But I’ve got some errors and maybe you could tell me what is wrong. I’ll also continue investigate this issue as well.
Error log:
➜ next-tinyhttp yarn dev
yarn run v1.22.5
$ node server.js
event - compiled successfully
> Ready on http://localhost:3000
(node:38326) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined
at /Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:34:97
at Array.find (<anonymous>)
at getRouteFromApp (/Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:34:58)
at /Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:298:39
at loop (/Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:324:34)
at /Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:308:21
at loop (/Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:324:34)
at /Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:308:21
at loop (/Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:324:34)
at /Users/vitalybaev/Documents/OpenSource/next-tinyhttp/node_modules/@tinyhttp/app/dist/index.cjs:308:21
(Use `node --trace-warnings ...` to show where the warning was created)
(node:38326) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:38326) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
To Reproduce
- Clone https://github.com/vitalybaev/next-tinyhttp
yarn
yarn dev
, wait for ready message- Open browser and navigate to the root
- But routes
/a
and/b
works well
Expected behavior
Server works fine, especially because tinyhttp aims to be a Express-like server.
You could see several custom server examples in Next.js repository (https://github.com/vercel/next.js/tree/canary/examples), directory starts with custom-server-*
Versions
node
: 14.9.0@tinyhttp/app
: 0.5.11
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Next.js custom server doesn't work if the server imports ...
Next.js custom server doesn't work if the server imports aysnc-listener and uses Webpack 5 #27792. Closed. danoc opened this issue on Aug 5, ......
Read more >Advanced Features: Custom Server
js doesn't go through babel or webpack. Make sure the syntax and sources this file requires are compatible with the current node version...
Read more >Setup - Create a Next.js App
If it doesn't work, please take a look at this page. Run the development server. You now have a new directory called nextjs-blog...
Read more >Advanced Features: Static HTML Export
js application to static HTML, which can be run standalone without the need of a Node.js server. It is recommended to only use...
Read more >Supported Browsers and Features
In addition, to reduce bundle size, Next.js will only load these polyfills for browsers that require them. The majority of the web traffic...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed
server.use
in0.5.12
try now with:
@talentlessguy
I’ve put up a pull request to add @vitalybaev! 🎉