Closed IsaacTrevino closed 3 years ago
@IsaacTrevino How are you configuring Amplify
? Can you share your code snippet?
import React from 'react';
import App from 'src/App';
import Amplify from 'aws-amplify';
import { Geo } from '@aws-amplify/geo';
import API from '@aws-amplify/api';
import Storage from '@aws-amplify/storage';
import Auth from '@aws-amplify/auth';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
API.configure(awsconfig);
Auth.configure(awsconfig);
Storage.configure(awsconfig);
Geo.configure(awsconfig);
I tried without the import Amplify from 'aws-amplify'
configuration as well but no luck.
Thanks @IsaacTrevino import Amplify from 'aws-amplify'
should work fine and you don't even need individual category configure calls.
From your environment information's npm packages it seems not all aws-amplify packages are taken from geo
tag. If you are installing aws-amplify
you don't need to also install individual packages and can still use imports @aws-amplify/<category>
. Can you reinstall aws-amplify
package with geo
tag and remove all other @aws-amplify/category
packages that you may have in your package.json
?
I had no idea you could still use @aws-amplify/<category>
without the need to install them individually.
However, after deleting my package-lock.js and node-modules and then reinstalling, I get this error.
./node_modules/maplibre-gl-js-amplify/dist/AmplifyMapLibreRequest.js Module not found: Can't resolve '@aws-amplify/geo' in '/home/****/<project-name>/node_modules/maplibre-gl-js-amplify/dist'
hmm this is strange. Can you let us know the version of aws-amplify
(from package.json) in your node_modules?
Yes, the same one mentioned in Env Details above.
"aws-amplify": "^4.2.1-geo.14"
"maplibre-gl": "^1.15.2",
"maplibre-gl-js-amplify": "^1.0.2",
"@maplibre/maplibre-gl-geocoder": "^1.0.0",
I am using npm i --legacy-peer-dependencies
for installing node-modules
I was able to reproduce it, it looks like semver issue where installing for ^4.2.1-geo.14
resolves in 4.2.2
. Can you try updating the package.json
with 4.2.1-geo.14
and installing it again?
I still receive the same error regards to maplibre-gl-js-amplify
needing @aws-amplify/geo
.
It now seems if I install npm i aws-amplify@4.2.2
, the Geo
library is missing.
Correct, aws-amplify@4.2.2
doesn't have the Geo
library. Is it possible for you to host your sample app on github where I can reproduce? Using npm i --legacy-peer-dependencies
with aws-amplify version 4.2.1-geo.14
in my package.json works fine.
So I've tested the aws-amplify@geo
aka aws-amplify@4.2.1-geo.14
or aws-amplify@4.2.1-geo.15
and it seems that maplibre-gl-js-amplify
is breaking the aws-amplify
library.
Somehow it's no longer reading the Auth
library, showing an error:
AuthError - Error: Amplify has not been configured correctly. The configuration object is missing required auth properties. This error is typically caused by one of the following
I will attempt to create a sample app and see if it works. Perhaps its another package that's also causing the issue.
Edit:
I've tested without the maplibre-gl-js-amplify
package and it seems Geo Class
works. However I need to use maplibre-gl-js.
Sample Amplify/Geo Project https://github.com/IsaacTrevino/AmplifyGeo
Having the same issue. How are you setting it up?
https://github.com/IsaacTrevino/AmplifyGeo/pull/1
It seems that removing the carrat did the trick in package.json
:
"@aws-amplify/ui-react": "^1.2.8",
"@maplibre/maplibre-gl-geocoder": "^1.0.0",
"aws-amplify": "4.2.1-geo.15",
"maplibre-gl": "^1.15.2",
"maplibre-gl-js-amplify": "^1.0.2",
However this must be installed at the creation of the package-lock.json
rather than installing individual packages afterwards.
@IsaacTrevino yes, If you use --save-exact
while installing aws-amplify@geo
the carat wouldn't be added automatically, or if you change the package.json to remove the carat, afterwards npm i
would not cause any issues.
Even though this is a fix, there seems to be DOM issues. Hopefully fixed on future updates.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Amplify Geo and MapLibre issues
Environment information
Describe the bug
Receiving this error: Error: No credentials at AmazonLocationServicesProvider. (AmazonLocationServicesProvider.ts:138)
I'm using the modular approach
@aws-amplify/geo
as its required by