calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
715 stars 228 forks source link

Unhandled rejection in react with S3 URL #162

Closed webtango closed 2 years ago

webtango commented 3 years ago

I have installed the package through npm and I import the package with: import { shpjs } from 'shpjs/dist/shp.js';

I have a function that gets the URL to my S3 bucket but when I call: shpjs(shapeFileURL).then(function(geojson){ console.log('Converted'); }).catch(function(error) { console.log(error); });

I get an exception: Unhandled Rejection (TypeError): Object(...) is not a function

Any advice on what I am doing wrong or if this is a known issue?

Thanks

calvinmetcalf commented 3 years ago

I'm going to need a little more info, what's the full stack trace ?

webtango commented 2 years ago

This is the stack from the browser:

tryCatch node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:62 Generator.invoke [as _invoke] node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:288 Generator.prototype. [as next] node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:114 asyncGeneratorStep node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:3 _next node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:25

Let me know if you need more.

Thanks

calvinmetcalf commented 2 years ago

that's not the real stack, please run

run

shpjs(shapeFileURL).then(function(geojson){
console.log('Converted');
}).catch(function(error) {
console.log('STACK:', error.stack);
});

and tell me what gets printed after STACK:

webtango commented 2 years ago

Sorry screw up on my part with my import. Should be import shpjs from 'shpjs'; I was doing it with brackets. import { shpjs } from 'shpjs';