Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages Not Working #36

Closed
1 of 2 tasks
dregge8 opened this issue Nov 9, 2017 · 6 comments
Closed
1 of 2 tasks

Messages Not Working #36

dregge8 opened this issue Nov 9, 2017 · 6 comments
Assignees

Comments

@dregge8
Copy link

dregge8 commented Nov 9, 2017

Is this a BUG REPORT or FEATURE REQUEST?:

  • BUG
  • FEATURE

What happened:
Starting a message does not open any type of window

What did you expect to happen:
Message popup

How to reproduce it (as minimally and precisely as possible):
I am using Chrome v61, click on any user in the online panel. Also clicking messages on the left hand side-panel does not seem to be showing anything besides the attempted conversations

server-side logs

11|trudesk | 11/9 11:32:44 [32201] - debug:  CastError: Cast to date failed for value "Invalid Date" at path "createdAt" for model "messages"
11|trudesk |     at new CastError (/home/trudesk/node_modules/mongoose/lib/error/cast.js:27:11)
11|trudesk |     at SchemaDate.cast (/home/trudesk/node_modules/mongoose/lib/schema/date.js:221:13)
11|trudesk |     at SchemaDate.handleSingle (/home/trudesk/node_modules/mongoose/lib/schema/date.js:256:15)
11|trudesk |     at SchemaDate.castForQuery (/home/trudesk/node_modules/mongoose/lib/schema/date.js:289:18)
11|trudesk |     at SchemaDate.SchemaType.castForQueryWrapper (/home/trudesk/node_modules/mongoose/lib/schematype.js:1035:17)
11|trudesk |     at cast (/home/trudesk/node_modules/mongoose/lib/cast.js:250:39)
11|trudesk |     at model.Query.Query.cast (/home/trudesk/node_modules/mongoose/lib/query.js:3204:12)
11|trudesk |     at model.Query.Query._castConditions (/home/trudesk/node_modules/mongoose/lib/query.js:1203:10)
11|trudesk |     at model.Query.Query._find (/home/trudesk/node_modules/mongoose/lib/query.js:1218:8)
11|trudesk |     at /home/trudesk/node_modules/kareem/index.js:250:8
11|trudesk |     at /home/trudesk/node_modules/kareem/index.js:23:7
11|trudesk |     at _combinedTickCallback (internal/process/next_tick.js:131:7)
11|trudesk |     at process._tickDomainCallback (internal/process/next_tick.js:218:9)

chrome logs

Error: {"message":"Cast to date failed for value \"Invalid Date\" at path \"createdAt\" for model \"messages\"","name":"CastError","stringValue":"\"Invalid Date\"","kind":"date","value":null,"path":"createdAt"}
    at new CastError (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/error/cast.js:27:11)
    at SchemaDate.cast (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/schema/date.js:221:13)
    at SchemaDate.handleSingle (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/schema/date.js:256:15)
    at SchemaDate.castForQuery (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/schema/date.js:289:18)
    at SchemaDate.SchemaType.castForQueryWrapper (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/schematype.js:1035:17)
    at cast (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/cast.js:250:39)
    at model.Query.Query.cast (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/query.js:3204:12)
    at model.Query.Query._castConditions (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/query.js:1203:10)
    at model.Query.Query._find (/Users/xxx/bitbucket/trudesk/node_modules/mongoose/lib/query.js:1218:8)
    at /Users/xxx/bitbucket/trudesk/node_modules/kareem/index.js:250:8
    at /Users/xxx/bitbucket/trudesk/node_modules/kareem/index.js:23:7
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Anything else we need to know?:

Environment:

  • Trudesk Version: 0.1.10
  • OS (e.g. from /etc/os-release): centos
  • Node.JS Version: v8.8.0
  • MongoDB Version: 2.6.12 - also attempted with v3.4.7 and had same error
  • Is this hosted on cloud.trudesk.io:
    no
@polonel
Copy link
Owner

polonel commented Nov 9, 2017

When you attempted to try with MongoDB version 3.4 was it with a fresh database or the one created from 2.6?

Trudesk Demo Site is running version 0.1.10 with MongoDB 3.4 from mLab.
You can see there how messages are intended to work.

Username: demo.user
Password: password

My best guess right now is that the MongoDB database was created with an older version of MongoDB mongoose v4 is incompatible with. If thats the case you can upgrade MongoDB and clear the conversations and messages collections.

@polonel polonel self-assigned this Nov 9, 2017
@dregge8
Copy link
Author

dregge8 commented Nov 10, 2017

OK, I will try with mLab and see if it works. Can you confirm what version of Node you are using? I wonder if that is my issue as well.

edit: I tried again, this time using mLab and messaging still does not work.

messages/conversation/start seems to initiate fine, work but not when clicking on the user, messages/conversation/user comes back with a 400 error

message start - http post conversation/start

curl 'http://trudesk.xxx.xyz/api/v1/messages/conversation/start' -H 'Cookie: _ga=GA1.2.226358401.1469884197; __cfduid=d7abe4e63ba60ed8c233faf022ea1d5411510162122; $trudesk%3Asidebar%3Aexpanded=false; connect.sid=s%3Az7BbzT-f6iTBpAUVDXyfIUxGDg-FEFg5.MYHjCWWTrWMA3kMc4dc2TF0UfgLTKzWOgbly8ecD2Eg; io=j_CX9Twq2wvgb5ZiAAAA' -H 'Origin: http://trudesk.xxx.xyz' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9,th-TH;q=0.8,th;q=0.7' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: http://trudesk.xxx.xyz/accounts' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data-binary '{"owner":"5a051a6a30ce9a29799b8843","participants":["5a051a6a30ce9a29799b8843","5a051b0a57fe4334eb21dd2c"]}' --compressed

message start - response

{"success":true,"conversation":{"_id":"5a051b4c57fe4334eb21dd2d","__v":0,"participants":[{"_id":"5a051a6a30ce9a29799b8843","username":"admin","fullname":"Admin","email":"[email protected]","title":"Administrator"},{"_id":"5a051b0a57fe4334eb21dd2c","username":"xxx","fullname":"John","email":"[email protected]","title":"John Dev"}],"userMeta":[{"updatedAt":"2017-11-10T03:21:48.078Z","createdAt":"2017-11-10T03:21:48.078Z","userId":"5a051a6a30ce9a29799b8843","joinedAt":"2017-11-10T03:21:48.070Z","lastRead":"2017-11-10T03:21:48.070Z"},{"updatedAt":"2017-11-10T03:21:48.078Z","createdAt":"2017-11-10T03:21:48.078Z","userId":"5a051b0a57fe4334eb21dd2c","joinedAt":"2017-11-10T03:21:48.070Z"}],"updatedAt":"2017-11-10T03:21:48.070Z","createdAt":"2017-11-10T03:21:48.070Z"}}

message conversation - http post conversation/5a051b4c57fe4334eb21dd2d

curl 'http://trudesk.xxx.xyz/api/v1/messages/conversation/5a051b4c57fe4334eb21dd2d' -H 'Cookie: _ga=GA1.2.226358401.1469884197; __cfduid=d7abe4e63ba60ed8c233faf022ea1d5411510162122; $trudesk%3Asidebar%3Aexpanded=false; connect.sid=s%3Az7BbzT-f6iTBpAUVDXyfIUxGDg-FEFg5.MYHjCWWTrWMA3kMc4dc2TF0UfgLTKzWOgbly8ecD2Eg; io=j_CX9Twq2wvgb5ZiAAAA' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9,th-TH;q=0.8,th;q=0.7' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36' -H 'Accept: */*' -H 'Referer: http://trudesk.xxx.xyz/accounts' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --compressed

message conversation - response

{"success":false,"error":"Cast to date failed for value \"Invalid Date\" at path \"createdAt\" for model \"messages\""}

node console

debug:  CastError: Cast to date failed for value "Invalid Date" at path "createdAt" for model "messages"
    at new CastError (/home/trudesk/node_modules/mongoose/lib/error/cast.js:27:11)
    at SchemaDate.cast (/home/trudesk/node_modules/mongoose/lib/schema/date.js:221:13)
    at SchemaDate.handleSingle (/home/trudesk/node_modules/mongoose/lib/schema/date.js:256:15)
    at SchemaDate.castForQuery (/home/trudesk/node_modules/mongoose/lib/schema/date.js:289:18)
    at SchemaDate.SchemaType.castForQueryWrapper (/home/trudesk/node_modules/mongoose/lib/schematype.js:1035:17)
    at cast (/home/trudesk/node_modules/mongoose/lib/cast.js:250:39)
    at model.Query.Query.cast (/home/trudesk/node_modules/mongoose/lib/query.js:3204:12)
    at model.Query.Query._castConditions (/home/trudesk/node_modules/mongoose/lib/query.js:1203:10)
    at model.Query.Query._find (/home/trudesk/node_modules/mongoose/lib/query.js:1218:8)
    at /home/trudesk/node_modules/kareem/index.js:250:8
    at /home/trudesk/node_modules/kareem/index.js:23:7
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

chrome console

https://trudesk.xxxx.com/api/v1/messages/conversation/5a051b4c57fe4334eb21dd2d 400 ()

[trudesk:chat:openChatWindow] - Error
{readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …}

Uncaught TypeError: Cannot read property 'userMeta' of undefined
    at 5.js:1
    at Object.error (5.js:1)
    at k (vendor.js:24)
    at Object.fireWith [as rejectWith] (vendor.js:24)
    at c (vendor.js:24)
    at XMLHttpRequest.<anonymous> (vendor.js:24)

@dregge8
Copy link
Author

dregge8 commented Nov 10, 2017

update: I tried using different versions of node with fresh installs and still receive the error
v6.12.0
v8.8
v9.1

@polonel
Copy link
Owner

polonel commented Nov 10, 2017

Thank you for all the information, it was very helpful. I have been able to reproduce the error and working on a fix.

Stay tuned 👍

polonel added a commit that referenced this issue Nov 10, 2017
polonel added a commit that referenced this issue Nov 10, 2017
@polonel
Copy link
Owner

polonel commented Nov 10, 2017

Fix is on master.
I'm going to close this issue. If you still have problem I will reopen.
Clear the conversations and messages collections once you've updated.

@polonel polonel closed this as completed Nov 10, 2017
@dregge8
Copy link
Author

dregge8 commented Nov 10, 2017

Hey, thanks for the help! I just reloaded and its working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants