codelab-friendlychat-web icon indicating copy to clipboard operation
codelab-friendlychat-web copied to clipboard

The messages are not displayed

Open gr8lakes opened this issue 5 years ago • 1 comments

Describe the bug Build the demo Cloud Functions for Firebase. After completing the deploy, try to send the message, but no message displayed.

Errors in the console:

Uncaught TypeError: timestamp.toMillis is not a function
    at createAndInsertMessage (main.js:265)
    at displayMessage (main.js:299)
    at main.js:77
    at Array.forEach (<anonymous>)
    at Object.next (main.js:72)
    at next (database.ts:1825)
    at async_observer.ts:51

Firebase-tools version: 7.7.0

To Reproduce Steps to reproduce the behavior:

  1. Deploy the project by following the sample Cloud Functions for Firebase
  2. Visit the page, input the message then send

Expected behavior The message is displayed on the page.

Additional context image

gr8lakes avatar Nov 18 '19 01:11 gr8lakes

Seems the toMillis function has been called twice https://github.com/firebase/friendlychat-web/blob/55d1ff58aff0131d3511bec9ccbfd4d8a99348b4/performance-monitoring-start/public/scripts/main.js#L77

https://github.com/firebase/friendlychat-web/blob/55d1ff58aff0131d3511bec9ccbfd4d8a99348b4/performance-monitoring-start/public/scripts/main.js#L277 which make the second time bumping error, also cause the message none show.

A quick fix is to make Line 277 as below timestamp = timestamp ? timestamp : Date.now(); Show be check whether it has further side affect also direct modified on the sample codebase.

TWsky avatar Dec 18 '19 03:12 TWsky