question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sub-app not working when mounted on "/"

See original GitHub issue

I was trying to mount a sub-app on the root (“/”) but it was throwing an error:

/node_modules/polka/index.js:95
		let loop = _ => res.finished || (i < len) && arr[i++](req, res, next);
		                                                     ^

TypeError: arr[(i++)] is not a function

I tracked the error back to the .use() function of polka:

use(base, ...fns) {
		if (typeof base === 'function') {
			this.wares = this.wares.concat(base, fns);
                  // SUB-APP IS NOT HANDLED WELL BECAUSE OF THIS CONDITIONAL:
		} else if (base === '/') { 
			this.wares = this.wares.concat(fns);
		} else {
			base = lead(base);
			fns.forEach(fn => {
				if (fn instanceof Polka) {
					this.apps[base] = fn;
				} else { ... etc ....

I have been trying to find a temporary fix without succes. Or is there another way to go about this?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
lukeedcommented, Oct 29, 2019

Available with polka@1.0.0-next.7 via npm install polka@next 👍

2reactions
matthewrobbcommented, Oct 9, 2019

I, too, am having this same problem exactly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

django makemigration throw error on sub app - Stack Overflow
If an application is nested and can not be imported from the Python ... The name "testing" seems very general and it could...
Read more >
Sub Applications - Mounts - FastAPI
"Mounting" means adding a completely "independent" application in a specific ... because the browser will be able to talk to each specific app...
Read more >
Hooks - Fiber
OnMount is a hook to execute user function after mounting process. The mount event is fired when sub-app is mounted on a parent...
Read more >
FAQ - qiankun - UmiJS
Solution 2: The micro-app is not bundle with umd , directly mount the life ... Try to set the webpack output.library of the...
Read more >
Express.js Mount Event - GeeksforGeeks
The mount event is fired on a sub-app when it is mounted on a ... Return Value: Since its an event so it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found