Turf: Turf.js@5 breaks on Mobile Safari on iOS 9.x and 10

Created on 1 Feb 2018  路  14Comments  路  Source: Turfjs/turf

I have reproduced this with the full, CDN-served build of turfjs. An easy way to see this is to navigate to turf's docs site on an iOS 9.x or 10 device. Turf examples do not work as expected, and when inspected over a Mac, mobile Safari gives the error: Attempting to change configurable attribute of unconfigurable property.

I was not able to narrow this down to a single turf module yet, but bboxPolygon is a potential candidate, judging from neighboring code in the minified build. The error occurs at 1:248611 with the CDN build for turf@5. Seems to be caused by an Object.defineProperties to override the name prop on the global Error class.

Seems to work on all other modern browsers by my testing.

EDIT: the exact build I'm using was downloaded from https://cdn.jsdelivr.net/npm/@turf/turf@5/turf.min.js.

bug remove-jsts

Most helpful comment

Using Turf 5.1.6, React Native 0.56.1.

Getting 'Attempting to change configurable attribute of unconfigurable property.' when running my project on Android. Tried using import tuf from '@turf/turf' as @karijkangas suggested, but it still gave me the same error. This workes on iOS however.

All 14 comments

馃 sounds like it might be a jsts issue, Object.defineProperties comes from the turf-jsts bundle:

https://cdn.jsdelivr.net/npm/[email protected]/jsts.js

馃 Next release (v6.0) we won't have jsts anymore and we will be using Martinez as a replacement.

@thesephist do you know from which version of Turf does it started to break with this error?

Turf version 3.9.0 works as expected; turf version 3.10.0 breaks, and as of turf 5.1.6 the issue is still present.

For sake of recordkeeping here's the corresponding issue on turf-jsts, which seems like the cause of the problem: https://github.com/DenisCarriere/turf-jsts/issues/3

Seeing this same issue with Turf 5.1.6, React Native 0.53, in both Android 8.0 emulator and Android 6.0 HW.

JavaScript:
import Turf from '@turf/turf';
Results to error:
E ReactNativeJS: Attempting to configurable attribute of unconfigurable property.

Modifying the code to use separate imports (e.g. import along from '@turf/along') works; at least for the modules I'm using :-)

Also, import Turf from '@turf/turf' works ok in iOS, both simulator and HW.

I also encountered this error for PhantomJS. Unfortunately, I couldn't find a workaround so far. Has there already any release date been announced for the upcoming turf.js version 6.0?

any release date been announced for the upcoming turf.js version 6.0?

At the moment, we're converting TurfJS to completely to Typescript, that way we don't have any CommonJS transpiling issues moving forward. (for more info https://github.com/Turfjs/turf/pull/1240)

At the moment, there are many modules that have already been published under v6, however @turf/turf will be the last one to be published.

@TobiTobsen92 @karijkangas Is there a particular module you are working with? Noticing you are using @turf/along, I've just published that module to v6.0, try to see if it works with PhantomJS.

https://unpkg.com/@turf/along@6.0.0/

I'm currently using separate imports and it's working ok. I added my comment above just with the hope that it would be picked up by search engines as it would have helped me to save some time in troubleshooting.

@karijkangas Thanks for the feedback! 馃憤

I'm glad to hear that separate imports do in fact work.

Once the code is ported over the Typescript, we "should" not have any issues with Mobile Safari 馃

@DenisCarriere I'm currently working with a range of modules, the particular functions which I'm using are lineIntersect, kinks, distance, lineString, convertLength and those related to great circle and rhumb line measurements/computations.

Closing; #88 is the tracking issue for JSTS.

Using Turf 5.1.6, React Native 0.56.1.

Getting 'Attempting to change configurable attribute of unconfigurable property.' when running my project on Android. Tried using import tuf from '@turf/turf' as @karijkangas suggested, but it still gave me the same error. This workes on iOS however.

I was getting the same build error on Android with RN 0.56.1

@gusoskar Check which specific module you are using from turf and see if a 6.0 version is available. For example I needed bbox so I installed @turf/bbox@latest => installs 6.0.1

That fixed my issue.

As @DenisCarriere mentioned they are porting the library over to Typescript (6.0) to avoid these transpiling errors

Any update?
I'm using version 5.1.6 with react native and I have this message
attempting to a configurable attribute of a configurable property in android

Please consult my reply to this thread, dated June 24, 2018, above, which contains a link to the issue that deals with fixing this issue, #88. and has a recent reply six days ago about a potential fix for the issue.

Was this page helpful?
0 / 5 - 0 ratings