aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

No map resources found in amplify config #9203

Closed mohammadid52 closed 2 years ago

mohammadid52 commented 3 years ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Geo

Amplify Categories

geo

Environment information

``` # Put output below this line amplify cli version - 4.6.0 npm aws-amplify version - 4.3.0 amplify status - ┌──────────┬──────────────────────┬───────────┬───────────────────┐ │ Category │ Resource name │ Operation │ Provider plugin │ ├──────────┼──────────────────────┼───────────┼───────────────────┤ │ Auth │ demoselready58be52e5 │ No Change │ awscloudformation │ ├──────────┼──────────────────────┼───────────┼───────────────────┤ │ Api │ demoselready │ No Change │ awscloudformation │ ├──────────┼──────────────────────┼───────────┼───────────────────┤ │ Storage │ demoselreadystorage │ No Change │ awscloudformation │ ├──────────┼──────────────────────┼───────────┼───────────────────┤ │ Function │ createUser │ No Change │ awscloudformation │ ├──────────┼──────────────────────┼───────────┼───────────────────┤ │ Function │ requestResetPassword │ No Change │ awscloudformation │ ├──────────┼──────────────────────┼───────────┼───────────────────┤ │ Geo │ lmsMap │ No Change │ awscloudformation │ └──────────┴──────────────────────┴───────────┴───────────────────┘ -- aws-exports.js "geo": { "amazon_location_service": { "region": "us-east-1", "maps": { "items": { "lmsMap-uatenv": { "style": "VectorEsriLightGrayCanvas" }, "map32a03f17-uatenv": { "style": "VectorEsriStreets" } }, "default": "map32a03f17-uatenv" } } }, ```

Describe the bug

No map resources found in amplify config, run 'amplify add geo' to create them and ensure to run amplify push after at AmazonLocationServiceProvider._verifyMapResources (AmazonLocationServiceProvider.js:273) at AmazonLocationServiceProvider.getDefaultMap (AmazonLocationServiceProvider.js:113) at GeoClass.getDefaultMap (Geo.js:140) at eval (AmplifyMapLibreRequest.js:105) at Generator.next () at eval (AmplifyMapLibreRequest.js:14) at new Promise () at awaiter (AmplifyMapLibreRequest.js:10) at Function.AmplifyMapLibreRequest.createMapLibreMap (AmplifyMapLibreRequest.js:103) at eval (AmplifyMapLibreRequest.js:113) at Generator.next () at eval (AmplifyMapLibreRequest.js:14) at new Promise () at awaiter (AmplifyMapLibreRequest.js:10) at createMap (AmplifyMapLibreRequest.js:112) at eval (EventMap.tsx:57)

Expected behavior

I am trying to render maps

Reproduction steps

  1. Install aws-amplify
  2. setup geo-map modules
  3. try to render map in DOM

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

TreTuna commented 2 years ago

This may be resolved at this point with newer versions, but we did have some versions where this issue turned up with the most common reasoning being that two versions of @aws-amplify/geo are being installed. You can either look in your node_modules (you may also want to check node_modules/aws-amplify/node_modules and node_modules/maplibre/node_modules) to see if another version is there) or the lock file for whichever package manager you are using, to verify if two versions being installed. If not, can you please let us know what versions for the following packages you have: aws-amplify @aws-amplify/geo maplibre-gl-js-amplify

mihaitaivli commented 2 years ago

Had a similar issue, related to what @TreTuna was saying - maplibre-gl-js-amplify didn't install a peer dep of @aws-amplify/geo so installing it manually resulted in this error. Fixed with removing @aws-amplify/geofrom my dep, deleting node_modules and the lock file and re-installing.

chrisbonifacio commented 2 years ago

Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you. Thank you!

k2-tek commented 2 years ago

I am having the same issue described in this thread. Can we reopen this bug report?

Error: No map resources found in amplify config, run 'amplify add geo' to create them and runamplify pushafter at AmazonLocationServiceProvider._verifyMapResources (AmazonLocationServiceProvider.js?f7b8:334:1) at AmazonLocationServiceProvider.getDefaultMap (AmazonLocationServiceProvider.js?f7b8:108:1) at GeoClass.getDefaultMap (Geo.js?c85f:136:1) at eval (AmplifyMapLibreRequest.js?e00d:103:1) at Generator.next (<anonymous>) at eval (AmplifyMapLibreRequest.js?e00d:7:1) at new Promise (<anonymous>) at __awaiter (AmplifyMapLibreRequest.js?e00d:3:1) at Function.AmplifyMapLibreRequest.createMapLibreMap (AmplifyMapLibreRequest.js?e00d:101:1) at eval (AmplifyMapLibreRequest.js?e00d:111:1)

RoshiniLamba commented 2 years ago

Facing the same issue. Re-installing packages after clearing them is not helping too. can anybody suggest a solution?

WWJakob commented 2 years ago

I am also facing the exact same issue. To me it started when installing new versions of maplibre-gl and maplibre-gl-js-amplify to: "maplibre-gl": "^2.1.9" "maplibre-gl-js-amplify": "^2.0.0" from using version that were on ^1.15.3 and ^1.5.0.

I need to upgrade to be able to use GeoFencing. Before the upgrade loading maps worked great.

Trying to remove node_modules and lock file and then doing an npm install don't help. Still get the same error.

Update Maybe I spoke to soon. Actually when I made sure that the lock file was deleted and all node_modules deleted and then doing npm install I got everything to work again with the updated versions.

abdallahshaban557 commented 2 years ago

@WWJakob - glad that resolved the issue for you! @RoshiniLamba - did you try following the same steps as @WWJakob ?

RoshiniLamba commented 2 years ago

@abdallahshaban557, deleting node_modules and package-lock.json and then installing all the packages again using npm i worked.