"Object { status: 403" ...."name: "e", message: "Forbidden", stack: ""

I’ve created an account and when using this MagicMirror module https://github.com/Travelbacon/MMM-TomTomTrafficIncidents I get the following errors:

> Uncaught TypeError: Cannot read property 'hardwareConcurrency' of MMM-TomTomTrafficIncidents
at maps-web.min.js:1
at n (maps-web.min.js:1)
at n (maps-web.min.js:1)
at Object. (maps-web.min.js:1)
at r (maps-web.min.js:1)
at Object. (maps-web.min.js:1)
at r (maps-web.min.js:1)
at Object. (maps-web.min.js:1)
at r (maps-web.min.js:1)
at maps-web.min.js:1

MMM-TomTomTrafficIncidents.js:69 Uncaught ReferenceError: tt is not defined
at HTMLScriptElement.script.onload (MMM-TomTomTrafficIn.......


Source map error: Error: request failed with status 404
Resource URL: hxxp://192.xxx.x.xxx:8080/modules/MMM-TomTomTrafficIncidents/tomtom-international-web-sdk-maps/maps-web.min.js
Source Map URL: maps-web.min.js.map

The module’s creator tried my API key and it gave him this error:

Object { status: 403, url: “https://api.tomtom.com/map/1/sprite/20.0.2-10/lite/sprite.json?key=xxxxxxx”, name: “e”, message: “Forbidden”, stack: “” }

I’ve looked at the possible causes of status: 403 in the tomtom documentation and none of them seem relevant. Can anyone here help? :slight_smile:

A lot of different errors here.
I’ve just checked this API request with your key and it works, so check for any typos, etc.
First error is probably caused by the second one.

404 means that the source map is not hosted with the app. You can download it and put it in the proper folder.

I wrote this module. Better to discuss here to fix this issue, instead on the Github repo. I checkd out a complete new MagicMirror on my Raspberry Pi 4. And my version works.

I start to think that there is some little typo as well.

Let’s begin with some basic settings.
1/ Are you 100% sure when you start the Magic Mirror, no errors or warnings appears about a incorrect config file?
2/ Are other modules loaded correctly?

This config is a copy and paste from my MM. Except I changed the location to a random place for privacy reasons.

           module: "MMM-TomTomTrafficIncidents",
            position: "top_right",
            config: {
                    key: "yourkey",
                    lng: 4.35,
                    lat: 54.06,
                    traffic: "relative",
                    height: "500px",
                    width: "500px",
                    zoom: 11

All the source needed is downloaded when you install the module. You have the option to set the option remoteTTCSSJS: true in the config. Then all the needed data will be requsted from the TomTom server.

Thank you for the reply! This is my config now:

  module: "MMM-TomTomTrafficIncidents",
        position: "top_right",
        config: {
                key: "keygoeshere",
                lng: 4.35,
                lat: 54.06,
                traffic: "relative",
                height: "500px",
                width: "500px",
          remoteTTCSSJS: true,
                zoom: 11

Since adding in the remoteTTCSSJS line, I now only get one error:

Uncaught TypeError: self.navigator is undefined
n mapbox-gl.js:29
n mapbox-gl.js:22
n mapbox-gl.js:33
Webpack 7



Uncaught ReferenceError: tt is not defined
onload http://192.xxx.1.xx:8080/modules/MMM-TomTomTrafficIncidents//MMM-TomTomTrafficIncidents.js:69

I’ve just run npm run config:check:

pi@MagicMirror:~/MagicMirror $ npm run config:check

magicmirror@2.12.0 config:check /home/pi/MagicMirror
node js/check_config.js

[2020-08-25 23:58:20.461] [INFO] Checking file… /home/pi/MagicMirror/config /config.js
[2020-08-25 23:58:20.753] [LOG] Line 1 col 1 Definition for rule ‘prettier/pr ettier’ was not found.
throw new Error(“Wrong syntax in config file!”);

Error: Wrong syntax in config file!
at /home/pi/MagicMirror/js/check_config.js:66:10
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_conte xt.js:53:3)
npm ERR! errno 1
npm ERR! magicmirror@2.12.0 config:check: node js/check_config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the magicmirror@2.12.0 config:check script.
npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-08-25T22_58_20_797Z-debug.log


sudo nano /home/pi/.npm/_logs/2020-08-25T22_58_20_797Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/bin/node’, ‘/usr/bin/npm’, ‘run’, ‘config:check’ ]
2 info using npm@6.14.6
3 info using node@v10.22.0
4 verbose run-script [ ‘preconfig:check’, ‘config:check’, ‘postconfig:check’ ]
5 info lifecycle magicmirror@2.12.0~preconfig:check: magicmirror@2.12.0
6 info lifecycle magicmirror@2.12.0~config:check: magicmirror@2.12.0
7 verbose lifecycle magicmirror@2.12.0~config:check: unsafe-perm in lifecycle true
8 verbose lifecycle magicmirror@2.12.0~config:check: PATH: /usr/lib/node_modules/npm/node_modu$
9 verbose lifecycle magicmirror@2.12.0~config:check: CWD: /home/pi/MagicMirror
10 silly lifecycle magicmirror@2.12.0~config:check: Args: [ ‘-c’, ‘node js/check_config.js’ ]
11 silly lifecycle magicmirror@2.12.0~config:check: Returned: code: 1 signal: null
12 info lifecycle magicmirror@2.12.0~config:check: Failed to exec config:check script
13 verbose stack Error: magicmirror@2.12.0 config:check: node js/check_config.js
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-l$
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-l$
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid magicmirror@2.12.0
15 verbose cwd /home/pi/MagicMirror
16 verbose Linux 4.19.118-v7+
17 verbose argv “/usr/bin/node” “/usr/bin/npm” “run” “config:check”
18 verbose node v10.22.0
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error magicmirror@2.12.0 config:check: node js/check_config.js

I see that you use sudo to obtain root rights. Perhaps you’ve installed more things under root? Because that would explain that some files can’t be found due user rights.

Ah I only did sudo nano out of habit to open the log, I have followed the MagicMirror manual install guide to the letter, nothing else is installed :slight_smile:

The error indicates and error in the config file.

I think you should go the Magic Mirror forum. And I was wandering if another 3th party module works. So that you can focus on the root cause.

I see an extra a slash in the reference to the MMM-TomTomTrafficIncidents.js. // instead of / And the module name is there twice. MM is looking for the scripts in a non existing folder. I think that that might be the reason the script was unable to load all scripts and other files. When you set the parameter to load the TomTom scripts from the internet works. MM didn’t start looking in the non existing folder but on the URL instead.

Remove the whole module and try make a new git clone in the directory modules.
git clone https://github.com/Travelbacon/MMM-TomTomTrafficIncidents ./
in /home/pi/MagicMirror/modules

About your key. Consider to generate a new one. It is known to the public.

I tested your key with a fresh clone of MM. And it works. There is a small installation error.
We should continue on the MagicMirror forum. The API of TomTom is working fine.