mapcache icon indicating copy to clipboard operation
mapcache copied to clipboard

Failed to parse dimension values: no <value> children supplied

Open sebastic opened this issue 7 years ago • 14 comments

It looks like the <dimensions> configuration is not actually optional as suggested by comment in the sample configuration.

When the <dimensions> configuration is not present in the mapcache configuration file, or when the sample configuration is used, apache fails to start:

failed to parse dimension values: no <value> children supplied

sebastic avatar Nov 22 '17 06:11 sebastic

Actually @tchaddad once hit this same error in MS4W about 10 months ago, with mapcache-master, but I could never reproduce the error locally: https://ms4w.com/trac/ticket/105 mapcache-master-error

jmckenna avatar Nov 23 '17 16:11 jmckenna

My findings are pretty much the same, with the 1.4.1 package from Debian stretch my mapcache configuration (which is a slightly modified default/sample configuration) works as expected, but with the 1.6.1 backport this issue is triggered.

sebastic avatar Nov 23 '17 16:11 sebastic

@sebastic, I'm unable to reproduce when there is no present for a tileset. I've updated the sample xml config file with the correct syntax.

tbonfort avatar Nov 24 '17 09:11 tbonfort

Even with the new syntax the error remains the same when using MapCache 1.6.1.

Having dug through the code a little more, I found the following.

In lib/service_wms.c the _configuration_parse_wms_xml() function calls the mapcache_dimension_values_create() function when it finds a <param> child in a <forwarding_rule> element. Which I have in my configuration:

<forwarding_rule name="WFS">
  <param name="SERVICE" type="values">WFS</param>
  <http>
    <url>http://example.com/some-map/wfs</url>
  </http>
  <append_pathinfo>false</append_pathinfo>
</forwarding_rule>

This will need to use the new syntax like <dimension type="values"> elements too, something the MIGRATION_GUIDE.txt does not document (nor does http://mapserver.org/mapcache/proxying.html).

Updating the syntax for the above fixes the issue in my setup.

sebastic avatar Nov 24 '17 10:11 sebastic

While the error at apache startup is resolved, the WMS-C service previously provided by the <service type="wms"> is now no longer working for SERVICE=WMS&REQUEST=GetCabilities requests., logging the following:

failed to validate requested value for dimension (SERVICE)

An explicit <forwarding_rule> for the WMS service needs to be added before the WFS service now:

<forwarding_rule name="WMS">
  <param name="SERVICE" type="values">WMS</param>
  <http>
    <url>http://example.com/some-map/wms</url>
  </http>
  <append_pathinfo>false</append_pathinfo>
</forwarding_rule>

<forwarding_rule name="WFS">
  <param name="SERVICE" type="values">WFS</param>
  <http>
    <url>http://example.com/some-map/wfs</url>
  </http>
  <append_pathinfo>false</append_pathinfo>
</forwarding_rule>

But then the WFS passthrough no longer works because the requested value cannot be validated.

It's unclear to me how WFS passthrough is supposed to be configured now.

sebastic avatar Nov 24 '17 11:11 sebastic

@sebastic can you share how you altered your forwarding rule to include the dimension syntax? I still have this problem, and have 2 forwarding rules that probably should be updated...

tchaddad avatar Jan 15 '18 21:01 tchaddad

See my previous comment, that's what I use now. Only the WMS-C works, WFS passthrough doesn't.

sebastic avatar Jan 15 '18 21:01 sebastic

Ah ok, thanks - my rules were for just for WMS (GetFeatureInfo and GetLegendGraphic), and syntax was already similar to what you had, so I don't think that was my problem.

Unfortunately, adding the syntax from 145a29b to my tilesets is also not solving my problem, so I guess I need to remain at 1.4.1 for now.

tchaddad avatar Jan 15 '18 22:01 tchaddad

Just to report back with some good news - I was able to finally get past this issue (started Apache successfully with MapCache 1.6), by altering my forwarding rules as follows:

Old Syntax:

 <forwarding_rule name="GetLegendGraphic rule">
             <append_pathinfo>true</append_pathinfo>
			<param name="SERVICE" type="values">WMS</param>
			<param name="REQUEST" type="values">GetLegendGraphic</param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
 </forwarding_rule> 

<forwarding_rule name="GetFeatureInfo rule">
        <append_pathinfo>true</append_pathinfo>
			<param name="SERVICE" type="values">WMS</param>
			<param name="REQUEST" type="values">GetFeatureInfo</param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
 </forwarding_rule>

New Syntax:

<forwarding_rule name="GetLegendGraphicRule">
          <append_pathinfo>true</append_pathinfo>
			<param name="SERVICE" type="values">
				<value>WMS</value>
			</param>
			<param name="REQUEST" type="values">
				<value>GetLegendGraphic</value>
			</param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
</forwarding_rule> 

<forwarding_rule name="GetFeatureInfoRule">
          <append_pathinfo>true</append_pathinfo>
			<param name="SERVICE" type="values">
				<value>WMS</value>
			</param>
			<param name="REQUEST" type="values">
				<value>GetFeatureInfo</value>
			</param>
            <http>
               <url>http://www.example.com/some-map/wms</url>
            </http>
</forwarding_rule> 

Hopefully this is helpful to others. Perhaps an example can be added to the sample config or other docs too?

tchaddad avatar Feb 20 '18 00:02 tchaddad

@tchaddad do you think issue #168 (and its solution) is related? (was that "failed to validate requested value for dimension" your most recent error?)

jmckenna avatar Feb 20 '18 17:02 jmckenna

hmm maybe it is not related, but I do wonder if we should go ahead and merge that fix in #168

jmckenna avatar Feb 20 '18 17:02 jmckenna

Hmm - no I never got the "failed to validate error", just the "failed to parse" because no child element was supplied. But I suppose I should do some tests to actually use the rule and see if it still works as expected. I'm just glad the first step allows Apache to start!

Another comment - the reason this error was so confusing was that the error message implies missing <value> in <dimensions>, while in this case it was actually missing <value> in the <forwarding_rule>. Without @sebastic pointing in that direction, it would have been very difficult to figure out (thanks!). So differentiating between the 2 problems in the error messages would be helpful to future users.

tchaddad avatar Feb 20 '18 18:02 tchaddad

Yes I'm very happy to hear that you can start Apache now (!!), glad you solved that.

jmckenna avatar Feb 20 '18 19:02 jmckenna

I created PR #303 on docs to update syntax discrepancies in Proxying Unsupported Requests document. Hope this solves part of the issue.

I also created PR #227 on MapCache to address misleading "dimension" reference. Hope this solves another part of the issue.

jbo-ads avatar Feb 03 '20 15:02 jbo-ads