mattermost-plugin-voice icon indicating copy to clipboard operation
mattermost-plugin-voice copied to clipboard

Error Starting Record: Recorder is not initialized

Open farshid33 opened this issue 4 years ago • 26 comments

Tested on Chrome 85,Desktop App and Firefox 80 Mattermost Version: 5.21.0

Uncaught (in promise) Error: Recorder not initialized at com.mattermost.voice_8d7088889a8f7053_bundle.js:16 at new Promise () at n.stop (com.mattermost.voice_8d7088889a8f7053_bundle.js:16) at ze.sendRecording (com.mattermost.voice_8d7088889a8f7053_bundle.js:24) at com.mattermost.voice_8d7088889a8f7053_bundle.js:24 at index.js:8 at middleware.js:81 at Object.send (redux.js:475) at com.mattermost.voice_8d7088889a8f7053_bundle.js:24 at Object.s (react-dom.production.min.js:14)

farshid33 avatar Sep 17 '20 09:09 farshid33

Hi @farshid33,

  1. Can you also share a screenshot of the network tab results when the error occurs?
  2. Are you running your Mattermost installation behind a proxy?
  3. Is Mattermost deployed in a subdirectory (e.g. https://yourdomain.com/mm/ )?

streamer45 avatar Sep 17 '20 14:09 streamer45

Hi @streamer45 1- nothing special in network when error occures. image 2- No.Mattermost installed in Ubuntu in valid ip binded to the url and NAT to server 3- No.the URL is https://mydomain.xyz/ and that's all.

farshid33 avatar Sep 20 '20 04:09 farshid33

Hi @streamer45 I think I found the problem. The site URL configured with WWW (https://www.mydomain.xyz) but I was opening with no www (https://mydomain.xyz). the plugin did not work with the url of no www.

farshid33 avatar Sep 20 '20 04:09 farshid33

Nice, thanks for letting me know. If the SiteURL is set then the plugin will use that to form the URLs and fetch the data it requires to run. I don't see those from your network tab screenshot, probably you should reload the page and disable the cache. It might have been a permission error since the origin wasn't the same. I believe a redirection would help here, to make sure only one version of the domain will be used (the one configured in SiteURL).

streamer45 avatar Sep 22 '20 07:09 streamer45

In my case, the domain is https://slack.microsoft.com/ Same bug behavior, apparently is something with the subdomain or domain, should I patch something? thanks in advance

phoenixsampras avatar Oct 13 '20 17:10 phoenixsampras

My site is setup on http://chat.domain.com:9948 but I have a nginx redirect to https://chat.domain.com. This plugin does not get initialized due to the url mismatch. If I download the source and build it with export MM_SERVICESETTINGS_SITEURL=https://chat.domain.com will it work? Thanks in advance.

prabaldey avatar Oct 15 '20 04:10 prabaldey

@phoenixsampras

Is your SiteURL configured correctly?

@prabaldey

You don't need to build it again. That's a configuration setting so you can either change its value in config/config.json or start the server with that environment variable set. Let me know if that still doesn't work.

In both cases it would be helpful to see which calls are failing and with what error (404 or else). This can be checked by taking a look at the developers tools network tab while loading the app, as suggested above.

streamer45 avatar Oct 17 '20 10:10 streamer45

Now I am getting this:

com.mattermost.voice_8d7088889a8f7053_bundle.js:16 Uncaught (in promise) Error: unsupported
    at n._startCapture (com.mattermost.voice_8d7088889a8f7053_bundle.js:16)
    at n.start (com.mattermost.voice_8d7088889a8f7053_bundle.js:16)
    at ze.startRecording (com.mattermost.voice_8d7088889a8f7053_bundle.js:24)
    at com.mattermost.voice_8d7088889a8f7053_bundle.js:24
    at Object.t.registerFileUploadMethod.ne.id [as action] (com.mattermost.voice_8d7088889a8f7053_bundle.js:24)
    at onClick (file_upload.jsx:626)
    at Object.s (react-dom.production.min.js:14)
    at f (react-dom.production.min.js:14)
    at react-dom.production.min.js:14
    at g (react-dom.production.min.js:15)

prabaldey avatar Oct 17 '20 18:10 prabaldey

@prabaldey

That error should happen mainly for two reasons. Either the app is not running on a secure connection (HTTPS) or somehow your browser has no support for capturing audio. What browser/OS (and versions) are you getting this error from?

streamer45 avatar Oct 17 '20 19:10 streamer45

So here is my entire situation.

I have Apache installed on port 80 and GitLab Omnibus installed on http port 8181 forwarded to https port 8182. I had to do this because port 80 and 443 are taken up by Apache and the only way I could get LetsEncrypt to work with the SSL certificate is to have a separate http port forwarding for GitLab.

I then configured GitLab Mattermost. I did not install Mattermost separately. I setup Mattermost using the same concept as GitLab - http port 9948 forwarding to https port 8065. If I did not put 9948 as the http port, Mattermost defaults to port 80 and everything stops because Apache is running on port 80.

So when I reconfigure GitLab, it automatically takes the Mattermost URL as http://chat.domain.com:9948 and internally forwards it to https://chat.domain.com. If I go into Mattermost console the webserver url is set to http://chat.domain.com:9948. When I run https://chat.domain.com, Mattermost works but the voice plugin shows the following error:

Mixed Content: The page at 'https://chat.domain.com/default-team/channels/town-square' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://chat.domain.com:9948/plugins/com.mattermost.voice/config'. This request has been blocked; the content must be served over HTTPS.

If I run Mattermost on http://chat.domain.com:9948/ then the plugin shows the following error:

com.mattermost.voice_8d7088889a8f7053_bundle.js:16 Uncaught (in promise) Error: unsupported
    at n._startCapture (com.mattermost.voice_8d7088889a8f7053_bundle.js:16)
    at n.start (com.mattermost.voice_8d7088889a8f7053_bundle.js:16)
    at ze.startRecording (com.mattermost.voice_8d7088889a8f7053_bundle.js:24)
    at com.mattermost.voice_8d7088889a8f7053_bundle.js:24
    at Object.t.registerFileUploadMethod.ne.id [as action] (com.mattermost.voice_8d7088889a8f7053_bundle.js:24)
    at onClick (file_upload.jsx:626)
    at Object.s (react-dom.production.min.js:14)
    at f (react-dom.production.min.js:14)
    at react-dom.production.min.js:14
    at g (react-dom.production.min.js:15)

I am caught in a catch-22 situation right now from the look of things.

prabaldey avatar Oct 18 '20 18:10 prabaldey

Thanks for the additional info @prabaldey. The plugin can only work on a secure connection hence the "unsupported" error. Is your SiteURL set? I am thinking that setting it to https://chat.domain.com could fix the issue. Or did you try that already?

streamer45 avatar Oct 18 '20 18:10 streamer45

Sorry for the late reply.

I did set the SiteURL to https://chat.domain.com but it is not changing anything. GitLab's configuration file is at /etc/gitlab/gitlab.rb. GitLab Mattermost's configuration file is at /var/opt/gitlab/mattermost/config.json. config.json SiteURL is blank initially. Changing it does not change anything. It seems Mattermost is picking up it's site url from /etc/gitlab/gitlab.rb. The variable is mattermost_external_url as shown here.

So is your plugin supposed to pickup the SiteURL from the /var/opt/gitlab/mattermost/config.json file?

prabaldey avatar Nov 03 '20 03:11 prabaldey

I did set the SiteURL to https://chat.domain.com but it is not changing anything. GitLab's configuration file is at /etc/gitlab/gitlab.rb. GitLab Mattermost's configuration file is at /var/opt/gitlab/mattermost/config.json. config.json SiteURL is blank initially. Changing it does not change anything. It seems Mattermost is picking up it's site url from /etc/gitlab/gitlab.rb. The variable is mattermost_external_url as shown here.

Okay maybe Gitlab is using the MM_SERVICESETTINGS_SITEURL environment variable to force a different setting. I believe that overrides the JSON config.

So is your plugin supposed to pickup the SiteURL from the /var/opt/gitlab/mattermost/config.json file?

Yes. The plugin will attempt to read the SiteURL from server config and if not empty will use that as the base for loading its files.

I guess one option would be to add a plugin specific config setting for a user-defined URL that takes precedence over anything else.

streamer45 avatar Nov 03 '20 10:11 streamer45

From what I have seen in my tests, the SiteURL in /var/opt/gitlab/mattermost/config.json is getting ignored. No matter what I do, the voice plugin always picks up the http url in the /etc/gitlab/gitlab.rb file. Since many people are facing this issue, it might be a great solution to add a plugin specific config setting that overrides everything else. You wouldn't have to spend so much time replying to all these posts then 😄

prabaldey avatar Nov 04 '20 07:11 prabaldey

Yes, the SiteURL will be ignored since an env variable in set. The plugin doesn't literally read the json file but goes through some API calls so that's why we get the other version.

I'll try to work on a fix in the next week or so.

streamer45 avatar Nov 09 '20 12:11 streamer45

Thank you. This is most appreciated.

prabaldey avatar Nov 11 '20 03:11 prabaldey

@prabaldey

In the meantime, I am wondering if in your specific case the previous version of this plugin would actually work. If I understood the problem correctly the failure is due to the latest changes. Before those we would ignore the SiteURL entirely. Might be worth giving it a try.

streamer45 avatar Nov 11 '20 10:11 streamer45

This should be (hopefully) fixed now. If you could give it a try it would be great. You will have to build the plugin from master branch (make dist cmd). I'll also publish a release at some point if everything works as expected.

streamer45 avatar Nov 14 '20 10:11 streamer45

I tried building the code but ran across this error.

[root@www mmvoice]# git clone https://github.com/streamer45/mattermost-plugin-voice.git
Cloning into 'mattermost-plugin-voice'...
remote: Enumerating objects: 184, done.
remote: Counting objects: 100% (184/184), done.
remote: Compressing objects: 100% (125/125), done.
remote: Total 184 (delta 86), reused 136 (delta 47), pack-reused 0
Receiving objects: 100% (184/184), 266.71 KiB | 0 bytes/s, done.
Resolving deltas: 100% (86/86), done.
[root@www mmvoice]# ls -lia
total 12
 1048586 drwxr-xr-x  3 root root 4096 Nov 19 22:56 .
50855942 drwxr-xr-x 13 root root 4096 Nov 19 22:56 ..
 1048596 drwxr-xr-x  8 root root 4096 Nov 19 22:56 mattermost-plugin-voice
[root@www mattermost-plugin-voice]# export MM_SERVICESETTINGS_SITEURL=https://chat.domain.com
[root@www mattermost-plugin-voice]# make dist
go: github.com/mattermost/mattermost-server/[email protected] requires
        github.com/mattermost/[email protected] requires
        github.com/go-asn1-ber/[email protected]: invalid pseudo-version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/9768874fee86a59054d303e43ea91580a0b259c16b29997c61cde648dc427e47: exit status 128:
        fatal: git fetch-pack: expected shallow list
go: github.com/mattermost/mattermost-server/[email protected] requires
        github.com/mattermost/[email protected] requires
        github.com/go-asn1-ber/[email protected]: invalid pseudo-version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/9768874fee86a59054d303e43ea91580a0b259c16b29997c61cde648dc427e47: exit status 128:
        fatal: git fetch-pack: expected shallow list
        fatal: The remote end hung up unexpectedly
make: build/bin/manifest: Command not found
build/setup.mk:16: *** "Cannot parse id from plugin.json".  Stop.

Here is the go version

[root@www mattermost-plugin-voice]# go version
go version go1.15.2 linux/amd64

I must be doing something wrong. If you could give me some pointers how to get rid of these errors then that will be great.

prabaldey avatar Nov 20 '20 04:11 prabaldey

@prabaldey

Looks like a problem with git. What's the output of git version? Can you try to update to the latest available?

streamer45 avatar Nov 20 '20 08:11 streamer45

Here is my git version.

[root@www mmvoice]# git --version
git version 1.8.3.1

Unfortunately this is a production server and this is the latest version of git for CentOS 7. I cannot risk forcing an update as it might break other programs running. Can I compile this on my local computer and then upload it to the server? In that case what would be the steps to follow?

Thanks.

prabaldey avatar Nov 20 '20 21:11 prabaldey

Here is my git version.

[root@www mmvoice]# git --version
git version 1.8.3.1

Unfortunately this is a production server and this is the latest version of git for CentOS 7. I cannot risk forcing an update as it might break other programs running. Can I compile this on my local computer and then upload it to the server? In that case what would be the steps to follow?

Thanks.

No worries, here's the build with latest changes: com.mattermost.voice-0.2.2.tar.gz

streamer45 avatar Nov 20 '20 22:11 streamer45

I installed this latest version but the plugin doesn't load at all. Here are the steps I followed.

  1. Went into SSH and ran the command mattermost plugin delete com.mattermost.voice. Plugin got deleted successfully. Went into the Mattermost System Console and under Plugins there was no longer a Voice option present.
  2. Now I downloaded your latest file.
  3. Now I installed the plugin using mattermost plugin add com.mattermost.voice-0.2.2.tar.gz. Plugin got successfully installed.
  4. I went to Mattermost System Console and the Voice option was there. I turned it on and refreshed the Mattermost channels. I clicked on the 📎 icon expecting the voice recorder to show up in the menu but it did not open. I was shown the file browse dialog box.
  5. I then turned on your screen recording plugin too and opened up the browser console. When I refreshed the chat I saw this message in the console Loaded plugin com.mattermost.screen, version 0.3.0 but there was no such message for the voice recorder plugin.
  6. I went into the System Console->Server Logs and found the following message.
{"level":"error","ts":1605920834.8097196,"caller":"mlog/log.go:190","msg":"Unable to activate plugin","plugin_id":"com.mattermost.voice","error":"unable to start plugin: com.mattermost.voice: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol.","errorVerbose":"Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol.\nunable to start plugin: com.mattermost.voice\ngithub.com/mattermost/mattermost-server/v5/plugin.(*Environment).Activate\n\tgithub.com/mattermost/mattermost-server/v5/plugin/environment.go:266\ngithub.com/mattermost/mattermost-server/v5/app.(*App).SyncPluginsActiveState\n\tgithub.com/mattermost/mattermost-server/v5/app/plugin.go:125\ngithub.com/mattermost/mattermost-server/v5/app.(*App).InitPlugins.func1\n\tgithub.com/mattermost/mattermost-server/v5/app/plugin.go:197\ngithub.com/mattermost/mattermost-server/v5/config.(*emitter).invokeConfigListeners.func1\n\tgithub.com/mattermost/mattermost-server/v5/config/emitter.go:36\nsync.(*Map).Range\n\tsync/map.go:333\ngithub.com/mattermost/mattermost-server/v5/config.(*emitter).invokeConfigListeners\n\tgithub.com/mattermost/mattermost-server/v5/config/emitter.go:34\ngithub.com/mattermost/mattermost-server/v5/config.(*commonStore).set\n\tgithub.com/mattermost/mattermost-server/v5/config/common.go:90\ngithub.com/mattermost/mattermost-server/v5/config.(*FileStore).Set\n\tgithub.com/mattermost/mattermost-server/v5/config/file.go:108\ngithub.com/mattermost/mattermost-server/v5/app.(*Server).SaveConfig\n\tgithub.com/mattermost/mattermost-server/v5/app/config.go:404\ngithub.com/mattermost/mattermost-server/v5/app.(*App).SaveConfig\n\tgithub.com/mattermost/mattermost-server/v5/app/config.go:433\ngithub.com/mattermost/mattermost-server/v5/api4.updateConfig\n\tgithub.com/mattermost/mattermost-server/v5/api4/config.go:116\ngithub.com/mattermost/mattermost-server/v5/web.Handler.ServeHTTP\n\tgithub.com/mattermost/mattermost-server/v5/web/handlers.go:240\ngithub.com/NYTimes/gziphandler.GzipHandlerWithOpts.func1.1\n\tgithub.com/NYTimes/[email protected]/gzip.go:336\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2041\ngithub.com/gorilla/mux.(*Router).ServeHTTP\n\tgithub.com/gorilla/[email protected]/mux.go:210\ngithub.com/getsentry/sentry-go/http.(*Handler).Handle.func1\n\tgithub.com/getsentry/[email protected]/http/sentryhttp.go:61\nnet/http.HandlerFunc.ServeHTTP\n\tnet/http/server.go:2041\nnet/http.serverHandler.ServeHTTP\n\tnet/http/server.go:2836\nnet/http.(*conn).serve\n\tnet/http/server.go:1924\nruntime.goexit\n\truntime/asm_amd64.s:1373"}
{"level":"info","ts":1605921141.5150325,"caller":"bleveengine/bleve.go:267","msg":"UpdateConf Bleve"}
{"level":"warn","ts":1605921141.5470974,"caller":"plugin/hclog_adapter.go:71","msg":"plugin failed to exit gracefully","plugin_id":"com.mattermost.voice"}

Please let me know if you need anything else from my end.

prabaldey avatar Nov 21 '20 01:11 prabaldey

@prabaldey

That's a new one for sure. What Mattermost version are you running?

EDIT:

Not sure what is the issue really but apparently it's something on my end when building the plugin. It works on latest MM version but doesn't on older ones. I've built another version of the plugin that should hopefully work, give it a try:

com.mattermost.voice-0.2.2.tar.gz

streamer45 avatar Nov 21 '20 07:11 streamer45

@streamer45 That worked! Thanks!!! I do have a question. When I record with my laptop it picks up a lot of echo because the laptop voice input seems to be picking up the output. Is there something that I can do to cut the echo out? Thanks again for everything.

prabaldey avatar Nov 24 '20 19:11 prabaldey

I am glad it finally worked :tada: As for the echo issue, you'd probably have to check that on your system's sound settings. Depending on your OS you might find some echo cancellation setting.

streamer45 avatar Nov 24 '20 19:11 streamer45