MMM-Remote-Control icon indicating copy to clipboard operation
MMM-Remote-Control copied to clipboard

API not reachable, error msg: Cannot GET /api/docs

Open Schnabulation opened this issue 1 year ago • 13 comments

OS

Raspberry Pi OS (Linux magicmirror 6.6.31+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux)

NodeJS Version

v22.9.0

MagicMirror² Version

2.29.0

Remote Control Version

2.3.8

Did you try using just Remote Control alone with MM?

  • [X] I have and the error still happening

Description

Brand new install of Magic Mirror using manual install on a Raspberry Pi 5.

MagicMirror and MMM-Remote-Control working flawlessly. Frontend of MagicMirror can be accessed from another machine (http://IP-of-MM:8080). Frontend of MMM-Remote-Control can be accessed from another machine (http://IP-of-MM:8080/remote.html).

However: I can not access the API endpoint. A normal GET request to http://IP-of-MM:8080/api/docs gets answered with Cannot GET /api/docs

Expected behavior

API request should be completed successfully.

Current behavior

Error message saying Cannot GET /api/docs

Possible solution

No response

Steps to reproduce

  1. Start MM
  2. Wait until everything starts
  3. Try to open "http://IP-of-MM:8080/api/docs"

Log

Nothing in log files regarding this issue. I started 'npm logs mm' and kept watching the logs as I send above request. No new entries.

config.js

let config = {
	address: "0.0.0.0", 	// Address to listen on, can be:
							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
							// - another specific IPv4/6 to listen on a specific interface
							// - "0.0.0.0", "::" to listen on any interface
							// Default, when address config is left out or empty, is "localhost"
	port: 8080,
	basePath: "/", 	// The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
					// you must set the sub path here. basePath must end with a /
	ipWhitelist: [], 	// Set [] to allow all IP addresses
															// or add a specific IPv4 of 192.168.1.5 :
															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true

	language: "de",
	locale: "de-CH",
	// logLevel: ["INFO", "LOG", "WARN", "ERROR"], // Add "DEBUG" for even more logging
    logLevel: ["WARN", "ERROR"], // Add "DEBUG" for even more logging
	timeFormat: 24,
	units: "metric",
	// serverOnly:  true/false/"local" ,
	// local for armv6l processors, default
	//   starts serveronly and then starts chrome browser
	// false, default for all NON-armv6l devices
	// true, force serveronly mode, because you want to.. no UI on this device

	modules: [
		{
			module: "alert",
		},
		{
			module: "MMM-Remote-Control",         
            config: {
                showModuleApiMenu: true,
                secureEndpoints: false,
                customCommand: {
                monitorOnCommand: 'WAYLAND_DISPLAY=wayland-1 wlr-randr --output HDMI-A-1 --on --transform 270',
                monitorOffCommand: 'WAYLAND_DISPLAY=wayland-1 wlr-randr --output HDMI-A-1 --off',
                monitorStatusCommand: '/home/steve/MagicMirror/monitorstatus.sh'
                }
            }
		},

Additional info

No response

Schnabulation avatar Oct 02 '24 07:10 Schnabulation

This module needs changes to work with new MagicMirror² version v2.29.0. A PR is on the way but I don't know who is maintaining this project at the moment ...

khassel avatar Oct 03 '24 09:10 khassel

Interesting, thank you for reply.

Regarding the aforementioned PR: the module works perfectly fine on my setup - only the API does not work. Stock install of the module btw.

Schnabulation avatar Oct 03 '24 09:10 Schnabulation

the api works with the PR, tested this ...

khassel avatar Oct 03 '24 09:10 khassel

the module works perfectly fine on my setup

not on my side, e.g. http://localhost:8080/remote.html#update-menu is always empty and http://localhost:8080/remote.html#module-control-menu is missing ...

khassel avatar Oct 03 '24 09:10 khassel

@ezeholz has done most of the maintenance for a long time. But if they are not available I can merge the PRs needed as well.

So #307 should fix the module and the API? Because I just saw #292 has also been open for a very long time, and am not sure if that would still be needed as well.

Jopyth avatar Oct 03 '24 09:10 Jopyth

So https://github.com/Jopyth/MMM-Remote-Control/pull/307 should fix the module and the API?

I did some cleanup/changes in the core mm for v2.29.0 which breaks this module at some points, https://github.com/Jopyth/MMM-Remote-Control/pull/307 is the fix for this.

With this fix the /api/docs shows the swagger site (whithout the fix you get the error described above), but I cannot say if the other PR is still needed.

khassel avatar Oct 03 '24 10:10 khassel

Having the same issue. @khassel's update is working well in my setup

ambarusa avatar Oct 03 '24 10:10 ambarusa

I've just installed MM on PC running Linux Mint (Ubuntu version) and have the same problem. I've tried to update MMM_Remote-Control but it tells me I'm up to date. I can see the remote web page but API does not connect. Is there a way I can fix this?

martbrad11 avatar Oct 05 '24 17:10 martbrad11

Clone this repo and branch temporarily:

https://github.com/khassel/MMM-Remote-Control/tree/mm_fixes

ambarusa avatar Oct 05 '24 17:10 ambarusa

So it's safe to merge? I cannot test it anymore, as I don't own a MM instalation anymore.

Sorry for the absence, a lot happened on my side.

ezeholz avatar Oct 05 '24 17:10 ezeholz

I can also confirm that @khassel:s PR works.

Snille avatar Oct 07 '24 11:10 Snille

Please confirm that it's actually working, khassel PR merged

ezeholz avatar Oct 08 '24 08:10 ezeholz

I can confirm, it works now. Thank you.

Snille avatar Oct 08 '24 08:10 Snille

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 20 '25 12:01 github-actions[bot]