GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.43k stars 1.12k forks source link

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

Closed syedfahimabrar closed 4 years ago

syedfahimabrar commented 4 years ago

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

  1. go to Url: http://localhost/maps/new

Specifications

t-book commented 4 years ago

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

ksonda commented 4 years ago

I have this same problem following instructions to install docker spcgeonode

t-book commented 4 years ago

@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 commented 4 years ago

It is most likely a MapStore issue. I guess we will need to do a new release of the mapstore client asap. There are other defected in the latest mapstore update I already have recognized.

Il giorno dom 29 mar 2020 alle ore 08:07 Syed Mohammad Fahim Abrar < notifications@github.com> ha scritto:

i think you have to add google map api key to re produce that scenario

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GeoNode/geonode/issues/5882#issuecomment-605588359, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJYARPPZHW4QWGHWEVTOS3RJ3QSRANCNFSM4LLZ3Y5A .

--

==

GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information.

Ing. Alessio Fabiani

@alfa7691 Founder/Technical Lead

GeoSolutions S.A.S. Via di Montramito 3/A - 55054 Massarosa (LU) - Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 331 6233686

http://www.geo-solutions.it http://twitter.com/geosolutions_it

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

t-book commented 4 years ago

@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: https://github.com/GeoNode/geonode-mapstore-client/issues/53 If you have any idea what and why the dev env changed I 'm all open ears.

afabiani commented 4 years ago

@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 commented 4 years ago

Thanks @afabiani

afabiani commented 4 years ago

@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 commented 4 years ago

@afabiani

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

I only have tested on SPC yet based on this comment https://github.com/GeoNode/geonode/issues/5882#issuecomment-603895315 @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.