gothinkster / aurelia-realworld-example-app

Exemplary real world application built with Aurelia
https://realworld.io
MIT License
183 stars 32 forks source link

Running without a backend: bug or not yet implemented feature #10

Closed adriatic closed 6 years ago

adriatic commented 6 years ago

This is really a question to @loaded02 (who leads the Aurelia conduit project if I understand it correctly), written here to keep things local to aurelia team until I get the grasp of who is who and when are PR's generated for the home team.


In order to find out what happens to the front end app if it cannot connect to the back end server, I did this

export const config = {
  //api_url: 'https://conduit.productionready.io/api'
  api_url: 'http://localhost:3000'
}

and stopped the local instance of the back end:

λ npm run dev                                                                                  

> conduit-node@1.0.0 dev C:\work\longarone\conduit\be\node-express-realworld-example-app       
> nodemon ./app.js                                                                             

[nodemon] 1.17.3                                                                               
[nodemon] to restart at any time, enter `rs`                                                   
[nodemon] watching: *.*                                                                        
[nodemon] starting `node ./app.js`                                                             
Listening on port 3000                                                                         
Mongoose: users.ensureIndex({ username: 1 }) { unique: true, background: true }                
Mongoose: articles.ensureIndex({ slug: 1 }) { unique: true, background: true }                 
Mongoose: users.ensureIndex({ email: 1 }) { unique: true, background: true }                   
Terminate batch job (Y/N)?                                                                     

^CC:\work\longarone\conduit\be\node-express-realworld-example-app (master) (conduit-node@1.0.0)

Starting the front end in such state results with a nice empty blog:

image

and not so nice content log in the Browser console:

Unhandled rejection TypeError: Cannot read property 'articles' of undefined
    at http://localhost:9000/scripts/app-bundle.js:624:69
From previous event:
    at HomeComponent.getArticles (http://localhost:9000/scripts/app-bundle.js:620:59)
    at HomeComponent.attached (http://localhost:9000/scripts/app-bundle.js:608:12)
    at Controller.attached (http://localhost:9000/scripts/vendor-bundle.js:22392:24)
    at View.attached (http://localhost:9000/scripts/vendor-bundle.js:20437:25)
    at ViewSlot.attached (http://localhost:9000/scripts/vendor-bundle.js:20800:15)
    at View.attached (http://localhost:9000/scripts/vendor-bundle.js:20447:21)
    at ViewSlot.attached (http://localhost:9000/scripts/vendor-bundle.js:20800:15)
    at http://localhost:9000/scripts/vendor-bundle.js:12846:30
From previous event:
    at Aurelia.setRoot (http://localhost:9000/scripts/vendor-bundle.js:12844:42)
    at http://localhost:9000/scripts/app-bundle.js:78:22
From previous event:
    at Object.configure (http://localhost:9000/scripts/app-bundle.js:77:21)
    at http://localhost:9000/scripts/vendor-bundle.js:11673:29
From previous event:
    at config (http://localhost:9000/scripts/vendor-bundle.js:11668:56)
    at http://localhost:9000/scripts/vendor-bundle.js:11704:14
From previous event:
    at bootstrap (http://localhost:9000/scripts/vendor-bundle.js:11703:26)
    at http://localhost:9000/scripts/vendor-bundle.js:11690:9
From previous event:
    at run (http://localhost:9000/scripts/vendor-bundle.js:11685:61)
    at Object.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:11710:37)
    at Object.execCb (http://localhost:9000/scripts/vendor-bundle.js:5484:33)
    at Module.check (http://localhost:9000/scripts/vendor-bundle.js:4671:51)
    at Module.enable (http://localhost:9000/scripts/vendor-bundle.js:4964:22)
    at Object.enable (http://localhost:9000/scripts/vendor-bundle.js:5345:39)
    at Module.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:4949:33)
    at http://localhost:9000/scripts/vendor-bundle.js:3922:23
    at each (http://localhost:9000/scripts/vendor-bundle.js:3847:31)
    at Module.enable (http://localhost:9000/scripts/vendor-bundle.js:4901:17)
    at Module.init (http://localhost:9000/scripts/vendor-bundle.js:4576:26)
    at http://localhost:9000/scripts/vendor-bundle.js:5248:36
printWarning @ vendor-bundle.js:1398
formatAndLogError @ vendor-bundle.js:1114
fireRejectionEvent @ vendor-bundle.js:1139
Promise._notifyUnhandledRejection @ vendor-bundle.js:585
(anonymous) @ vendor-bundle.js:564
vendor-bundle.js:1398 Unhandled rejection TypeError: Cannot read property 'tags' of undefined
    at http://localhost:9000/scripts/app-bundle.js:1611:21
From previous event:
    at TagService.getList (http://localhost:9000/scripts/app-bundle.js:1610:43)
    at HomeComponent.getTags (http://localhost:9000/scripts/app-bundle.js:635:23)
    at HomeComponent.attached (http://localhost:9000/scripts/app-bundle.js:609:12)
    at Controller.attached (http://localhost:9000/scripts/vendor-bundle.js:22392:24)
    at View.attached (http://localhost:9000/scripts/vendor-bundle.js:20437:25)
    at ViewSlot.attached (http://localhost:9000/scripts/vendor-bundle.js:20800:15)
    at View.attached (http://localhost:9000/scripts/vendor-bundle.js:20447:21)
    at ViewSlot.attached (http://localhost:9000/scripts/vendor-bundle.js:20800:15)
    at http://localhost:9000/scripts/vendor-bundle.js:12846:30
From previous event:
    at Aurelia.setRoot (http://localhost:9000/scripts/vendor-bundle.js:12844:42)
    at http://localhost:9000/scripts/app-bundle.js:78:22
From previous event:
    at Object.configure (http://localhost:9000/scripts/app-bundle.js:77:21)
    at http://localhost:9000/scripts/vendor-bundle.js:11673:29
From previous event:
    at config (http://localhost:9000/scripts/vendor-bundle.js:11668:56)
    at http://localhost:9000/scripts/vendor-bundle.js:11704:14
From previous event:
    at bootstrap (http://localhost:9000/scripts/vendor-bundle.js:11703:26)
    at http://localhost:9000/scripts/vendor-bundle.js:11690:9
From previous event:
    at run (http://localhost:9000/scripts/vendor-bundle.js:11685:61)
    at Object.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:11710:37)
    at Object.execCb (http://localhost:9000/scripts/vendor-bundle.js:5484:33)
    at Module.check (http://localhost:9000/scripts/vendor-bundle.js:4671:51)
    at Module.enable (http://localhost:9000/scripts/vendor-bundle.js:4964:22)
    at Object.enable (http://localhost:9000/scripts/vendor-bundle.js:5345:39)
    at Module.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:4949:33)
    at http://localhost:9000/scripts/vendor-bundle.js:3922:23
    at each (http://localhost:9000/scripts/vendor-bundle.js:3847:31)
    at Module.enable (http://localhost:9000/scripts/vendor-bundle.js:4901:17)
    at Module.init (http://localhost:9000/scripts/vendor-bundle.js:4576:26)
    at http://localhost:9000/scripts/vendor-bundle.js:5248:36
printWarning @ vendor-bundle.js:1398
formatAndLogError @ vendor-bundle.js:1114
fireRejectionEvent @ vendor-bundle.js:1139
Promise._notifyUnhandledRejection @ vendor-bundle.js:585
(anonymous) @ vendor-bundle.js:564
adriatic commented 6 years ago

Please ignore the crash report (I am leaving it undeleted to admit how I made silly error re-configuring my local front end:

Instead of

export const config = {
  //api_url: 'https://conduit.productionready.io/api'
  api_url: 'http://localhost:3000'
}

I should set the api_url to api_url: 'http://localhost:3000/api'

Apologies for even daring to think that such "bug" would have not been addressed :smirk:

loaded02 commented 6 years ago

Is this still a bug or should we close this one?

adriatic commented 6 years ago

This is not a bug, it should be closed. However, I found that if both FE and BE stay running without any user actions from the FE, at some point BE fails to respond, claiming that some data is undefined. I will watch for this issue.