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.

Hydrate Issue when setting up an Express subapp using mountpath

See original GitHub issue

What version of Remix are you using?

1.5.1

Steps to Reproduce

I’ve created an example repo https://github.com/christophior/remix-express-mountpath-example

Steps include:

  • create a basic Remix app using Express as the server
  • update server.js to mount a subapp which will be used for our app
  • update our remix.config.js so that our public path is updated to hit the new subpath

Expected Behavior

Application loads when hitting subpath instead of quickly flashing rendered page followed by a white page.

Actual Behavior

When you run the application and hit a route in the subpath, for instance /example or /example/counter you will see the page render for a split second before displaying a white page.

Currently my example repo shows the following error in the console:

Warning: Did not expect server HTML to contain a <script> in <html>.

but I have also seen the following error in another project:

Warning: Did not expect server HTML to contain a <div> in <div>.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
chaancecommented, Jun 6, 2022

I wouldn’t say this is hacky, rather it’s exactly why we expose lower level APIs like createRequestHandler in the first place. This isn’t an extremely common use-case, but it is something we want to enable if you are running your own server!

1reaction
kilimancommented, May 26, 2022

Ok whatever you choose you need to make sure that Remix routes match the URL in the browser. That is you cannot do URL rewriting on the server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - understanding app.mountpath property of express
The mountpath property simply contains the route pattern where a specific sub-app was mounted i.e. in the above example:
Read more >
Express.js app.mountpath Property - GeeksforGeeks
The app.mountpath property contains one or more path patterns on which a sub-app was mounted. Syntax: app.mountpath.
Read more >
Node.js and Express Tutorial: Build a Website Using Pug - Auth0
Learn how to use Express and the Pug template engine to build a website in Node.js. Create user interfaces using Pug and CSS...
Read more >
How to use the app object in Express.js | by John Au-Yeung
mountpath property has one or more path patterns which the sub-app was mounted. A sub-app is an instance of express that's used for...
Read more >
API Reference - Express 4.x
A sub-app is an instance of express that may be used for handling the request to ... Check out the query parser application...
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