<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CORS policy]]></title><description><![CDATA[<p dir="auto">Hi all,</p>
<p dir="auto">Upon loading my magicmirror today, I’ve been met with an issue in relation to the default weather module, starting in dev mode has shown me the error</p>
<p dir="auto">access to xmlhttprequest at from origin has been blocked by cors policy the access control allow origin header contains multiple values ‘*, *’ but only one is allowed</p>
<p dir="auto">after googling, and seeing the results, it’s way above my (non-existent) technical know-how.</p>
<p dir="auto">Is anyone able to shed any light (in lay man’s terms)?</p>
<p dir="auto">Thanks,</p>
]]></description><link>https://forum.magicmirror.builders/topic/17313/cors-policy</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 14:44:30 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/17313.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Oct 2022 13:01:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 12:58:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a>  thanks for the key</p>
<p dir="auto">the error is</p>
<pre><code>Your request count (159) is over the allowed limit of 50 per day - Upgrade your key, or retry after 670.2 minutes
</code></pre>
<p dir="auto">and u have 2 modules configured, so each will fetch separately, so u have to change the  update cycle to once/hour<br />
in both modules, (default 10 mins)</p>
<pre><code>updateInterval: 60 * 60 * 1000
</code></pre>
<p dir="auto">and every MM restart sends 2 requests, 1 for each module</p>
<p dir="auto">change the new code to look like this…</p>
<pre><code>				if(!data || (data &amp;&amp; data.error) || data.status_message){
					Log.error("Could not load data ... ", data?(data.error|| data.status_message): "no data returned");
				}
				else {
					if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
						// No usable data?
						return;
					}

					const currentWeather = this.generateWeatherDayFromCurrentWeather(data);
					this.setCurrentWeather(currentWeather);
				}
</code></pre>
<p dir="auto">crappy api implementation… should set error for all errors, not<br />
put error info in good data returns</p>
]]></description><link>https://forum.magicmirror.builders/post/105488</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105488</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Tue, 25 Oct 2022 12:58:07 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 11:11:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> can u email me your apikey</p>
<p dir="auto">same userid as on this post<br />
at gmail</p>
<p dir="auto">or send me a direct message</p>
<p dir="auto">the returned data is not coming back in the expected format</p>
]]></description><link>https://forum.magicmirror.builders/post/105483</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105483</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Tue, 25 Oct 2022 11:11:40 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 11:07:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> from the line Could not load data … TypeError: Cannot read properties of undefined (reading ‘0’) at <a href="http://weatherbit.is" target="_blank" rel="noopener noreferrer nofollow ugc">weatherbit.is</a></p>
]]></description><link>https://forum.magicmirror.builders/post/105482</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105482</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Tue, 25 Oct 2022 11:07:42 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 11:06:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
so I commented out the original text and added in the new:</p>
<pre><code>code_text
``` fetchCurrentWeather() {
		this.fetchData(this.getUrl())
			.then((data) =&gt; {
				/*if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
					// No usable data?
					return;
				}

				const currentWeather = this.generateWeatherDayFromCurrentWeather(data);
				this.setCurrentWeather(currentWeather);*/
				if(!data || (data &amp;&amp; data.error)){
					Log.error("Could not load data ... ", data?data.error: "no data returned");
				}
				else {
					if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
						// No usable data?
						return;
					}

					const currentWeather = this.generateWeatherDayFromCurrentWeather(data);
					this.setCurrentWeather(currentWeather);
				}
			})
			.catch(function (request) {
				Log.error("Could not load data ... ", request);
			})
			.finally(() =&gt; this.updateAvailable());</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/105481</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105481</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Tue, 25 Oct 2022 11:06:10 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 10:56:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> ok, lousy provider error reporting…</p>
<p dir="auto">i want you to edit the provider  weatherbit.js and</p>
<p dir="auto">using your config (with the bad apikey) I get the ‘0’ error too</p>
<p dir="auto">change this (starting on line 38)</p>
<pre><code>					if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
						// No usable data?
						return;
					}

					const currentWeather = this.generateWeatherDayFromCurrentWeather(data);
					this.setCurrentWeather(currentWeather);
</code></pre>
<p dir="auto">to this</p>
<pre><code>				if(!data || (data &amp;&amp; data.error)){
					Log.error("Could not load data ... ", data?data.error: "no data returned");
				}
				else {
					if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
						// No usable data?
						return;
					}

					const currentWeather = this.generateWeatherDayFromCurrentWeather(data);
					this.setCurrentWeather(currentWeather);
				}
</code></pre>
<p dir="auto">then save and<br />
restart mm, open the developers window<br />
ctrl-shift-i<br />
select the console tab<br />
and enter  weath<br />
in the filter field</p>
<p dir="auto">there should be a red line of text , with the weatherbit.js name to the right</p>
]]></description><link>https://forum.magicmirror.builders/post/105480</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105480</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Tue, 25 Oct 2022 10:56:58 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 10:31:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
ok, have put it back to how it was… that was final “can I get this to work, before I ask for further help”<br />
this is my config.js</p>
<pre><code>code_text
``` {
			module: "weather",
			position: "top_right",
			config: {
				weatherProvider: "weatherbit",
				type: "current",
				lat: 5,
				lon: -1,
				apiKey: "ab4",
				useCorsProxy: true
					}
		},
		{
			module: "weather",
			position: "top_right",
			header: "Weather Forecast",
			config: {
				weatherProvider: "weatherbit",
				type: "forecast",
				lat: 5,
				lon: -1,
				initialLoadDelay: 1,
				apiKey: "ab4",
				useCorsProxy: true
					}
		},</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/105479</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105479</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Tue, 25 Oct 2022 10:31:14 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 10:22:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> never edit our code, all config goes in config.js</p>
<p dir="auto">u need lat and long (how else does it know where u are)</p>
<p dir="auto">all numbers and true/false have no quotes<br />
anything with a letter or special character does need quotes</p>
<p dir="auto">u need weatherProvider<br />
apikey<br />
lat<br />
lon<br />
and type (forecast or current)<br />
and</p>
<p dir="auto">useCorsProxy: true</p>
]]></description><link>https://forum.magicmirror.builders/post/105478</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105478</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Tue, 25 Oct 2022 10:22:40 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Tue, 25 Oct 2022 10:03:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/karsten13" aria-label="Profile: karsten13">@<bdi>karsten13</bdi></a> have added in the useCorsProxy: true</p>
<p dir="auto">Have since updated MagicMirror, now getting</p>
<p dir="auto">Could not load data …  TypeError: Cannot read properties of undefined (reading ‘0’)</p>
<p dir="auto">which when clicked on shows weatherbit.js</p>
<pre><code>code_text
```/* global WeatherProvider, WeatherObject */

/* MagicMirror²
 * Module: Weather
 * Provider: Weatherbit
 *
 * By Andrew Pometti
 * MIT Licensed
 *
 * This class is a provider for Weatherbit, based on Nicholas Hubbard's class
 * for Dark Sky &amp; Vince Peri's class for Weather.gov.
 */
WeatherProvider.register("weatherbit", {
	// Set the name of the provider.
	// Not strictly required, but helps for debugging.
	providerName: "Weatherbit",

	// Set the default config properties that is specific to this provider
	defaults: {
		apiBase: "https://api.weatherbit.io/v2.0",
		apiKey: "",
		lat: 0,
		lon: 0
	},

	fetchedLocation: function () {
		return this.fetchedLocationName || "";
	},

	fetchCurrentWeather() {
		this.fetchData(this.getUrl())
			.then((data) =&gt; {
				if (!data || !data.data[0] || typeof data.data[0].temp === "undefined") {
					// No usable data?
					return;```
</code></pre>
<p dir="auto">Forgive me, again for being a noob, but I didn’t think this required any information in, however having substituted the lat and lon zero’s for my location, still throws up the same and error and points me to the [0] following !data.data</p>
]]></description><link>https://forum.magicmirror.builders/post/105477</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105477</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Tue, 25 Oct 2022 10:03:45 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 19:24:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/karsten13" aria-label="Profile: karsten13">@<bdi>karsten13</bdi></a> getting that way</p>
<p dir="auto">localhost is usually allowed 0.0.0.0 ( I consider to be a bug to send this anywhere) is not</p>
]]></description><link>https://forum.magicmirror.builders/post/105460</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105460</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 24 Oct 2022 19:24:36 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 19:13:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a></p>
<p dir="auto">had to look in the code again … but may we should set default <code>true</code> for all providers …</p>
]]></description><link>https://forum.magicmirror.builders/post/105459</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105459</guid><dc:creator><![CDATA[karsten13]]></dc:creator><pubDate>Mon, 24 Oct 2022 19:13:54 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 19:11:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/karsten13" aria-label="Profile: karsten13">@<bdi>karsten13</bdi></a> ah, I thought we went proxy everywhere</p>
]]></description><link>https://forum.magicmirror.builders/post/105457</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105457</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 24 Oct 2022 19:11:55 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 18:39:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a></p>
<p dir="auto">I think the cors proxy is not new in the weather module (but in newsfeed) so last release should work.</p>
<p dir="auto">The cors proxy was not enabled for all weather providers, only for <code>envcanada</code> and <code>darksky</code>, so it must be enabled in the config for <code>weatherbit</code> by adding <code>useCorsProxy: true,</code> to the weather config.</p>
]]></description><link>https://forum.magicmirror.builders/post/105456</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105456</guid><dc:creator><![CDATA[karsten13]]></dc:creator><pubDate>Mon, 24 Oct 2022 18:39:44 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 16:35:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> there were two choices</p>
<p dir="auto">manual install</p>
<p dir="auto">git checkout develop<br />
git pull<br />
npm install</p>
<p dir="auto">or the other</p>
]]></description><link>https://forum.magicmirror.builders/post/105451</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105451</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 24 Oct 2022 16:35:30 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 14:57:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> I used the MagicMirror installation instructions (assuming manual install) to install the software.</p>
<p dir="auto">Have just tried your git fetch origin<br />
But get fatal: Refusing to fetch into current branch refs/heads/develop of none-bare repository.</p>
<p dir="auto">(Sorry, you’re probably shaking your head, but I am a complete noob at all this)</p>
]]></description><link>https://forum.magicmirror.builders/post/105449</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105449</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:57:28 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 14:45:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> custom.css is because it doesn’t exist by default. if u used my install script I create it for you</p>
<p dir="auto">touch ~/MagicMirror/css/custom.css</p>
]]></description><link>https://forum.magicmirror.builders/post/105448</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105448</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:45:30 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 14:36:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> yes, followed your instructions to the letter</p>
]]></description><link>https://forum.magicmirror.builders/post/105447</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105447</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:36:59 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 14:13:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> did u git pull, npm install  after switch</p>
]]></description><link>https://forum.magicmirror.builders/post/105446</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105446</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:13:28 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 14:10:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
I’ve tried to do that, now get pretty much the same result, but with a slightly different bit at the end.</p>
<p dir="auto">Access to fetch at ‘<a href="https://api.weatherbit.io/v2.0/forecast/daily?lat=xxx&amp;lon=-xxx&amp;units=M&amp;key=a%E2%80%A6" target="_blank" rel="noopener noreferrer nofollow ugc">https://api.weatherbit.io/v2.0/forecast/daily?lat=xxx&amp;lon=-xxx&amp;units=M&amp;key=a…</a>’ from origin ‘<a href="http://localhost:8080" target="_blank" rel="noopener noreferrer nofollow ugc">http://localhost:8080</a>’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.<br />
<a href="http://api.weatherbit.io/v2%E2%80%A6:1" target="_blank" rel="noopener noreferrer nofollow ugc">api.weatherbit.io/v2…:1</a><br />
Failed to load resource: net::ERR_FAILED<br />
weatherbit.js:66 Could not load data …  TypeError: Failed to fetch<br />
at Class.fetchData (weatherprovider.js:136:27)<br />
at Class.fetchWeatherForecast (weatherbit.js:53:8)<br />
at weather.js:184:27<br />
weather.js:150 New weather information available.<br />
localhost/:1 Refused to apply style from ‘<a href="http://localhost:8080/css/custom.css" target="_blank" rel="noopener noreferrer nofollow ugc">http://localhost:8080/css/custom.css</a>’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.</p>
]]></description><link>https://forum.magicmirror.builders/post/105445</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105445</guid><dc:creator><![CDATA[bicolorbore586]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:10:51 GMT</pubDate></item><item><title><![CDATA[Reply to CORS policy on Mon, 24 Oct 2022 14:00:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bicolorbore586" aria-label="Profile: bicolorbore586">@<bdi>bicolorbore586</bdi></a> use the develop branch. they have just reworked all the weather providers to handle this.<br />
see<br />
<a href="https://forum.magicmirror.builders/topic/14327/testing-new-fixes-or-solving-current-problems-with-next-release-code">https://forum.magicmirror.builders/topic/14327/testing-new-fixes-or-solving-current-problems-with-next-release-code</a></p>
]]></description><link>https://forum.magicmirror.builders/post/105444</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/105444</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 24 Oct 2022 14:00:42 GMT</pubDate></item></channel></rss>