Closed (fixed)
Project:
Private Message Node.js
Version:
8.x-1.0-beta3
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
26 May 2018 at 14:43 UTC
Updated:
14 Jun 2018 at 23:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
zenimagine commentedComment #3
jaypanDid you add the path to nodejs in the private message configuration?
What I'm seeing is that you have successfully started nodejs, but if its not working, the scripts that connect to it are not finding it for some reason.
Comment #4
zenimagine commentedin my first post, I added a screenshot of the configuration
https://www.domaine.com
Watch the console in the inspector
Comment #5
jaypanIs node.js availble at www.domaine.com?
Comment #6
zenimagine commentedno the domain is ok but it does not work
Comment #7
jaypanI'm sorry, I can't really help from here. Everything looks right, and it works for me. Please let me know if you have more information to provide.
Comment #8
zenimagine commentedHere are the only informations I have
Comment #9
zenimagine commentedwhen I send messages, there is nothing in the logs
Comment #10
jaypanDid you install the Vendor Stream Wrapper module?
Comment #11
zenimagine commentedyes, it is installed
Comment #12
zenimagine commentedBefore uninstalling it, the https://www.drupal.org/project/nodejs module has been configured like this and it works :
# nano nodejs.config.js
Does the configuration of nodeJS support the https ?
Where is the configuration in node_modules ?
It's weird that the webmaster is nothing to configure in node_modules
How is the backend managed?
Some site uses nodejs on a separate server. Would not it be advisable to configure node_modules manually with:
- serviceKey
- port
- host
- scheme
Comment #13
jaypanThe current module doesn't use any of that.
Comment #14
zenimagine commentedI updated #12
Comment #15
zenimagine commentedWith my installation the backend uses port 443. Does your module support you?
Comment #16
jaypanNodejs is listening on port 8080.
Comment #17
zenimagine commentedThis is the case of my configuration.
The node js server is on 8080
But the domain is on 443 (https)
So the module manages ports 80 and 443 for the backend ?
Comment #18
jaypanNo. You may have to set the node.js URL to not be https.
Comment #19
zenimagine commentedIt is not possible.
I have apache header that requires secure connection.
Some browser blocks all unsecured urls
Comment #20
jaypanOk, I've found a module that handles HTTPS for nodejs. Next time I get some time to work on this I'll incorporate this module.
Comment #21
jaypanComment #22
zenimagine commentedOk thank you I will wait
Comment #23
zenimagine commentedmaybe this question is related to this one ;
https://www.drupal.org/project/private_message/issues/2970962
Comment #24
jaypanComment #26
jaypanOk, please try again. You'll need to set up the configuration for the module. Instructions can be found here: https://www.drupal.org/docs/8/modules/private-message/nodejs-integration
Comment #27
jaypanOh, and you'll also need to run
composer update, and ensure that the external library is updated, as well as both the private_message_nodejs module and the vendor_stream_wrapper module.Comment #28
zenimagine commentedShould it use the beta 4 or the dev.
I made the update Composer, but there is no config folder.
root@vps000000:/home/www.domaine.com/public_html/vendor/jaypan/private-message-nodejs# lsapp.js composer.json node_modules package.json package-lock.json README.md
Comment #29
jaypanThe current version of the remote library is 0.3.0. You need to ensure that you have that.
Comment #30
zenimagine commentedHow can I know the version?
- Updating drupal/vendor_stream_wrapper (1.0.0-beta2 => 1.0.0-beta3): DownloadDownloading (100%)
- Updating drupal/private_message_nodejs (1.0.0-beta3 => 1.0.0-beta4): DownloaDownloading (100%)
Comment #31
zenimagine commentedHere is what I did, but the "config" folder does not exist
Comment #32
jaypanRun this:
composer require jaypan/private-message-nodejsComment #33
zenimagine commentedThe version is in 0.2 but he does not want to update
Comment #34
zenimagine commentedComment #35
jaypanOk, try updating this module to 8.x-1.0-beta5, then running composer update.
Comment #36
zenimagine commentedI can not update to beta 5. I'm trying to uninstall the module but I can not remove it from Composer
Comment #37
zenimagine commentedI found, you must manually delete the node_modules folder
Why compose install by defaul beta version 4 ?
Comment #38
zenimagine commentedI completely removed the module and installed it again with Composer.
He does not want to download the beta 5 and stays on the beta 4.
If I request the dev version I have the error in the screenshot.
Comment #39
jaypanYou probably need to run
composer clearcache. Composer caches it's values for 24 hours by default I think.Comment #40
zenimagine commentedthat does not solve the problem
Comment #41
jaypanAlright, I've done an update of pretty much all modules. Make sure that you follow the update instructions included with the release:
https://www.drupal.org/project/private_message/releases/8.x-2.0-beta7
Comment #42
zenimagine commentedI think the module has not been properly uninstalled. I have this error message that prevents installation. What should I do ?
Comment #43
jaypanRe-install the message module, and that should solve the problem.
Comment #44
zenimagine commentedCan not reinstall the module. It displays #42
Comment #45
zenimagine commentedComment #46
zenimagine commentedI found, there remained messages from the module "Message"
Comment #47
zenimagine commentedThere is a problem, when the "Private Message" module is uninstalled, the message template in the "Message" module is not deleted.
Comment #48
zenimagine commentedI erased everything and checked that the files were erased. I cleaned the cace of "Composer", but it does not work ?
Comment #49
jaypanComment #50
jaypanOk, I think I've fixed everything with the newest version of the module. Try this:
Then follow the directions here: https://www.drupal.org/docs/8/modules/private-message/nodejs-integration...
If anything goes wrong, uninstall the modules in Drupal, uninstall them in composer ensure everything is gone, then run
composer require drupal/private_message_nodejsand try again.Comment #51
zenimagine commentedThank you, the installation worked.
But I still have errors in the console. I do not understand why.
I added screenshots of my configuration.
Comment #52
zenimagine commentedIt would be necessary for other people to test an https installation, to know if it comes from the module or my site. The funny thing is that with the drupal module nodejs integration, this configuration worked.
Comment #53
jaypanYou need to change
path/to/privateKey.keyto the actual path of the private key on your server. And you need to changepath/to/certificate.crtto the actual path to the certificate on your site.That configuration was specific to the nodejs module. That module is entirely unrelated to this module, which is why a configuration for that module has no relevance to the configuration of this module.
Comment #54
zenimagine commentedOk, the red message is gone, but I still have:
DevTools failed to parse SourceMap: https://www.domaine.com/vendor_files/socket.io.js.map
Messages are not refreshed
Can you tell me if in the screenshots my configuration is correct?
Comment #55
zenimagine commentedIs there a delay to set to activate nodejs ?
Comment #56
zenimagine commentedThere are no errors in /reports/dblog
Comment #57
jaypanHave you got the Drupal node.js module enabled? Maybe it's conflicting. This module doesn't even use the file socket.io.js.map. You're going to have to do some detective work to find out what code is calling that.
Comment #58
zenimagine commentedHow to be sure that the module is directly linked to the nodejs server?
There should be a message in the Drupal dashboard.
Yes, there is only the Private Message NodeJS module installed.
The warning appears only in Chrome. On Firefox there is no error, but I have to refresh the page manually to see the messages.
How can I know if the nodejs server communicates with the site?
Comment #59
zenimagine commentedOK ;-) I found. The secret does not match in the logs, when I send a message.
Yet, look at my previous screenshot, the secret is the same.
Comment #60
zenimagine commentedSo the site communicates well with the nodejs server and the settings are correct.
There is a problem with the "secret"
Comment #61
zenimagine commentedIt should also be added to the documentation the installation of PM2 which is essential to see the logs nodejs and maintain the connection
http://pm2.keymetrics.io/
It is very easy to install and use.
Comment #62
zenimagine commentedComment #63
zenimagine commentedThere are also two warning when I restart app.js I do not know if it concerns the module directly
Comment #64
jaypanYou didn't enter the full secret. There are more characters to the right.
Comment #65
zenimagine commentedI put a word in identical secret in drupal and it does not work
Comment #66
zenimagine commentedhave you managed to reproduce the problem
Comment #67
jaypanNo. But I've added a bunch of debugging to the module. If you do an update with composer, you should be on
jaypan/private-message-nodejs: 0.3.3
drupal/private_message_nodejs: 1.0.0-beta8
Then clear your cache, go to Admin -> Configuration -> Private Message -> Settings and enable debugging for node.js. Then try the private message page. After that, you can check the Drupal logs, the browser console, and the app.js output to get more information about what is happening. See if you can find some additional information as to why it is not working for you.
Comment #68
zenimagine commentedThe module does not seem to be working since the update. Pm2 logs are full of errors.
I have recreated the default.json file
There are no errors in the Drupal logs
Comment #69
zenimagine commentedI made the update to the beta 9. Here is the status of the module
Comment #70
zenimagine commentedI tested again and I still have the errors
Comment #71
jaypanThose errors mean you haven't run npm install.
Comment #72
zenimagine commentedThank you. The message has changed but I still have the error and the secret. I made a copy paste and they are identical
Comment #73
zenimagine commenteddelete
Comment #74
jaypanOk, please do the following:
1) Move the
[VENDOR LIBRARY]/jaypan/private-message-nodejs/configfolder to[VENDOR LIBRARY]/jaypan/config. I have moved this folder out of the library, so that it doesn't have to be re-created every time the library is updated2) Run
composer clearcache;composer update3) Run
npm installin the libraryI added a report on the site status page, so that may give you some additional information.
Note that I updated the instructions here: https://www.drupal.org/docs/8/modules/private-message/nodejs-integration
Comment #75
zenimagine commentedI did not understand steps 5 and 6. I uninstalled and installed the module to start over from the beginning. Can you tell me if the structure of the screenshots are correct ? Thank you
Comment #76
zenimagine commentedI tested with the configuration above, but I still have the secret problem
Comment #77
zenimagine commentedIf I put a different secret, it shows on the dashboard that the server is misconfigured.
If I put an identical secret, it displays on the dashboard that the server is correctly configured.
But in the PM2 logs, it indicates that the secret does not match.
Comment #78
zenimagine commentedI have another problem. If I am authenticated, the site works. If I am anonymous, I have a blank page on the whole site with this message "The website encountered an unexpected error. Please try again later.".
See #73
Comment #79
jaypanWhat happens if you run
node app.jsinstead of using pm2?Comment #80
jaypanYes, that is correct.
Comment #81
zenimagine commentedWhy is there a default.json file in config and another in private-message-nodejs?
Without PM2 it's the same result.
Do you know what is causing the problem #73 (If I disable the notification block, the error disappears.) ?
Comment #82
zenimagine commentedI do not understand, when I restart app.js it marks that he received the secret "mathieu".
If I send messages, it does not work anymore.
Comment #83
jaypanWhat version of the module are you on? And what version of the remote library?
Comment #84
zenimagine commentedThe beta version 10. How to know the version of the library ?
The library is on the same server as my site.
The version of the library could be displayed on the dashboard
Comment #85
jaypanYou can run
composer show jaypan/private-message-nodejs, and it will tell you the version number.Comment #86
zenimagine commentedThis is version 0.3.6
Comment #87
zenimagine commentedThe default.json file must be in the "config" folder only? It does not have to be as in private-message-nodejs ? #81
Comment #88
jaypanBoth of those are correct.
Comment #89
zenimagine commentedOk. I do not see where the problem is with the secret. I have no error message.
Comment #90
zenimagine commentedI updated to beta 11 and I have the same error message. Do you know if other users have tested the module?
Comment #91
jaypanNo, I think it's just you and I. But I think we're getting closer.
I just added a bunch of more debug code. I think no matter what happens, it will be easier to trace any problem. Please update, clear all caches etc, and try again. Create a private message, and visit the thread. Show me the output from that please.
Comment #92
zenimagine commentedWhat should I do for the update. Should I delete manually folder?
Comment #93
zenimagine commenteddelete
Comment #94
jaypanWhat is the output in the JavaScript console on the page where you are seeing all those errors?
Comment #95
zenimagine commentedthere is no error in the console
Comment #96
zenimagine commentedThe problem is always the same. In the logs I see that he verifies and finds the secret and the second according to he verifies and no longer finds the secret.
In the dashboard, the status of "Private Message Node.js" is updated in real time.
But not the message of the thread.
Comment #97
jaypanYou need to turn on debugging to get the output from the console. Debugging is turned on in the configuration page.
Comment #98
zenimagine commentedDebugging is already enabled
Comment #99
jaypanEnabling debugging outputs debugging information in the console. If debugging is enabled and you are not getting any output, it means you must have a cached version of the module scripts. This would explain why you are still getting errors - the scripts in the browser that interact with the Nodejs server must match the application. If your script is outdated, it will not be passing the secret correctly, and therefore you are getting errors.
You'll need to ensure that the private_message_node_js/js/*.js files are the current versions.
For example, privatemessage_node_js/js/private_message_nodejs.form.js should be this:
Load the page in your browser, view the HTML source, copy the URL for private_message_nodejs.thread.js, and open that in the browser. You'll see the JavaScript being used. It needs to match what I just pasted above (8.x-1.0-beta12).
Comment #100
zenimagine commentedHere is what I have :
https://www.domaine.com/modules/contrib/private_message_nodejs/js/privat...
Comment #101
zenimagine commentedI
drush crevery update. Why does the file remain in memory ?Comment #102
jaypanI don't know. But that's not the right file.
Comment #103
zenimagine commentedI never had a problem with other libraries.
Do you have a command to update the cache ?
Comment #104
jaypanI don't know. This is a problem with your system, not with the module. You'll need to figure out why your system is caching the script and not using the new script that comes with the most recent version of the module. I would suggest uninstall removing the private_message_nodejs module from the system with composer. Confirm that the module does not exist anymore. Then clear your cache, and re-install the module with composer.
You can clear the cache with drush cr.
Comment #105
zenimagine commentedThanks it works now ;-)
I erased the browser cache.
Comment #106
zenimagine commentedComment #107
jaypanGreat! I'm glad we got it worked out. It was a bit of a pain, with a lot of work, but actually it has made the module much stronger and much easier to debug now through trying to fix this, so it's a good result.
Thanks for sticking through it with me.