Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: t.indexOf is not a function " javascript error in http://localhost/maps/new route #5882

Closed
syedfahimabrar opened this issue Mar 16, 2020 · 9 comments · Fixed by #5946
Labels
major A high priority issue which might affect a lot of people or large parts of the codebase regression Issues related to regressions.
Milestone

Comments

@syedfahimabrar
Copy link

Expected Behavior

The page should load a map.

Actual Behavior

Instead of loading map it is showing
image
this image and giving a javascript error:
TypeError: t.indexOf is not a function at validateVersion (ms2-geonode-api.js:38) at ms2-geonode-api.js:91 at p (ms2-geonode-api.js:91) at e.componentDidUpdate (ms2-geonode-api.js:91) at ou (ms2-geonode-api.js:75) at e.unstable_runWithPriority (ms2-geonode-api.js:83) at Ni (ms2-geonode-api.js:75) at iu (ms2-geonode-api.js:75) at Bs (ms2-geonode-api.js:75) at ms2-geonode-api.js:75 at e.unstable_runWithPriority (ms2-geonode-api.js:83) at Ni (ms2-geonode-api.js:75) at Hi (ms2-geonode-api.js:75) at Fi (ms2-geonode-api.js:75) at Rs (ms2-geonode-api.js:75) at Object.enqueueSetState (ms2-geonode-api.js:75) Va @ ms2-geonode-api.js:75

Steps to Reproduce the Problem

1.Login as admin
2. go to Url: http://localhost/maps/new

Specifications

@t-book t-book added frontend Issues regarding Frontend and styling needs further investigation Issue or reason for specific behaviour needs further investigation labels Mar 16, 2020
@t-book
Copy link
Contributor

t-book commented Mar 22, 2020

@lazyfahim Just tried but cannot reproduce this. Does this problem still exist? If so which version? 2.10?

@ksonda
Copy link

ksonda commented Mar 25, 2020

I have this same problem following instructions to install docker spcgeonode

@t-book t-book added major A high priority issue which might affect a lot of people or large parts of the codebase regression Issues related to regressions. and removed frontend Issues regarding Frontend and styling needs further investigation Issue or reason for specific behaviour needs further investigation labels Mar 28, 2020
@t-book
Copy link
Contributor

t-book commented Mar 28, 2020

@afabiani @giohappy

I have tested that one and can confirm a regression with docker master spc (haven't tested the "offical" docker stack yet).

The problem is:

const validateVersion = version => version && version.indexOf('${mapstore2.version}') === -1 && version.indexOf('no-version') === -1 ? true : false;

https://github.com/geosolutions-it/MapStore2/blob/22bbfe82be2db71cd622d27bed457ccd41bb1332/web/client/selectors/version.js#L10

which translates after a build to:

        validateVersion: function(t) {
            return !(!t || -1 !== t.indexOf("${mapstore2.version}") || -1 !== t.indexOf("no-version"))
        }

In our case var t (or version) is (int) 3 hence indexOf as string or array method fails. On a working instance it has been (string) 3.0.dev1576768625 (which most likely comes from __init.py of geonode or PKG-INFO)

For me it looks like innermostProps.version is not type save

https://github.com/geosolutions-it/MapStore2/blob/22bbfe82be2db71cd622d27bed457ccd41bb1332/web/client/components/theme/Theme.jsx#L19

This wonders as it is checked here:
https://github.com/geosolutions-it/MapStore2/blob/22bbfe82be2db71cd622d27bed457ccd41bb1332/web/client/components/theme/Theme.jsx#L69

I haven't tested yet if going back to ms-client 2.0.1 or 2.0.0 could solve it.
I can try to solve it hopefully coming week nevertheless in case a mapstore developer knows the answer by heart we could save some time ;)

@afabiani
Copy link
Member

afabiani commented Mar 30, 2020 via email

@t-book
Copy link
Contributor

t-book commented Mar 30, 2020

@afabiani thanks. I think it could be solved easily by just making sure version in state is always a string. Unfortunately, I cannot help here as I'm blocked with mapstore development on master because of: GeoNode/geonode-mapstore-client#53 If you have any idea what and why the dev env changed I 'm all open ears.

@afabiani
Copy link
Member

@t-book those should be recent changes introduced by @allyoucanmap in order to make more easy the configuration of the dev environment.

I'm going to ask him to reply to your questions. It is probably better to open issues directly on the MapStore repo in order to have more chances to get a reply soon.

@t-book
Copy link
Contributor

t-book commented Mar 30, 2020

Thanks @afabiani

@afabiani
Copy link
Member

@t-book so this issue seems to be happening only on SPC-Geonode? I'm wondering how the GeoNode version could be translated into the ${mapstore2.version} and also how is it possible that this does not happen on a standard setup?

Could be an issue with older spc geonode docker images?
Can you identify where this variable is injected?

@t-book
Copy link
Contributor

t-book commented Mar 30, 2020

@afabiani

so this issue seems to be happening only on SPC-Geonode?

I only have tested on SPC yet based on this comment #5882 (comment)
@lazyfahim can you please tell us which environment you have used?

I'm wondering how the GeoNode version could be translated into the ${mapstore2.version}

I haven't found any evidence so far how this should work. But did not have a closer look as the new mapstore dev setup on master blocked me.

Could be an issue with older spc geonode docker images?

Good idea but the question why this suddenly fails remains.

Can you identify where this variable is injected?

On my local paver setup $version is
3.0.dev1576768625 I could find this value in PKG-INFO but did not check yet where it is actually passed to mapstore state.

t-book added a commit to csgis/geonode that referenced this issue Apr 2, 2020
@t-book t-book added this to the 3.0 milestone Apr 2, 2020
t-book added a commit that referenced this issue Apr 2, 2020
Fixes #5882 Mapstore fails with version 3.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major A high priority issue which might affect a lot of people or large parts of the codebase regression Issues related to regressions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants