scully: cli: support catch all routes (i.e. to a custom 404 page)
Steps to Reproduce
ng add @scullyio/init
npm i --save-dev fs-extra
ng build
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.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (14 by maintainers)
@Splaktar Yes, a partial fix might be in a bit earlier, but that one closed it completely.
@SanderElias Are you able to share your PR? I’d like to test it if I can.
I’m pretty sure just need to move the
_pong
andkillMe
routes above the routes loop here: https://github.com/scullyio/scully/blob/596d09296ea78d100d5093c2af9683a79483ed5f/scully/utils/staticServer.ts#L37I haven’t yet been able to build scully for dev so I can’t test that.
Edit: PR submitted. Tested locally.
That worked (after killing the
node
process that was still around from the previous run)!Try removing the ** catch all…
I see the same issue… nothing special in my test app. Generated a new ng8 app using the cli,
ng updated
to ng9-rc, thenng add
ed scully.Running
npm run scully
throws theInvalid content-type
errors.I see lots of
js
files indist/static
, however, all js requests on http://localhost:1864/ return contents ofindex.html
.