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.

cli: support catch all routes (i.e. to a custom 404 page)

See original GitHub issue

Steps to Reproduce

  1. ng add @scullyio/init
  2. npm i --save-dev fs-extra
  3. ng build
  4. npm run scully

Error

Cleaned up /Users/splaktar/Git/.../dist/static/ folder.
started servers in background
Invalid content-type.
Expected application/json but received text/html; charset=UTF-8
<repeated about 30 times>
Invalid content-type.
Expected application/json but received text/html; charset=UTF-8
Could not connect to server

The debugger indicates that this is caused by the following line https://github.com/scullyio/scully/blob/eba6fba6a5df182137fdb7b434893162bc962dc3/scully/utils/waitForServerToBeAvailable.ts#L13

That URL (http://localhost:1864/_pong) seems to be returning my Angular app (in a broken state) rather than some JSON content.

Root Cause

A route like {path: '**', component: PageNotFoundComponent} breaks the ability to run Scully. Removing it works around the problem, but breaks the app’s custom 404 page.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
SanderEliascommented, Jan 9, 2020

@Splaktar Yes, a partial fix might be in a bit earlier, but that one closed it completely.

1reaction
Hypercubedcommented, Dec 27, 2019

@SanderElias Are you able to share your PR? I’d like to test it if I can.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make a catch all route to handle '404 page not found ...
I got my error handling to work by creating an ErrorController that returns the views in this article. I also had to add...
Read more >
Using a culture constraint and redirecting 404s with the url ...
In this post, I'll show how we can create a custom route constraint to help prevent invalid route matching, and add additional routes...
Read more >
Routing in ASP.NET Core - Microsoft Learn
Routing is responsible for matching incoming HTTP requests and dispatching those requests to the app's executable endpoints.
Read more >
How to Craft the Best 404 Pages for your Clients - Shopify
A good custom 404 page will help people find the information ... to avoid any confusion, with a search bar and links to...
Read more >
Dynamic Routes - Next.js
Dynamic Routes are pages that allow you to add custom params to your URLs. ... Catch all routes can be made optional by...
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 Hashnode Post

No results found