New AWS Amplify withAuthenticator error related to maplibre-gl-js-amplify - amazon-web-services

NPM recommended I upgrade aws-amplify to the latest version yesterday, which I did. I then started a new React project in a dev environment (using "npm start"). The package.json file indicates these dependency versions:
"dependencies": {
"#aws-amplify/ui-react": "^2.15.1",
"aws-amplify": "^4.3.18",
"maplibre-gl-js-amplify": "^1.4.1",
... (other irrelevant dependencies removed for this example)
},
Upon calling the line below:
import { withAuthenticator } from '#aws-amplify/ui-react';
I get 12 similar errors of the same issue. Here is one such error:
WARNING in ./node_modules/#aws-amplify/ui-react/node_modules/maplibre-gl-js-amplify/lib/esm/AmplifyMapLibreGeocoder.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'C:\projects\amplify-project\node_modules\#aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify\src\AmplifyMapLibreGeocoder.ts' file: Error: ENOENT: no such file or directory, open 'C:\projects\amplify-project\node_modules\#aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify\src\AmplifyMapLibreGeocoder.ts'
# ./node_modules/#aws-amplify/ui-react/node_modules/maplibre-gl-js-amplify/lib/esm/index.js 3:0-86 6:0-134 6:0-134
# ./node_modules/#aws-amplify/ui-react/dist/esm/components/Geo/MapView/index.js 5:0-69 35:16-17
# ./node_modules/#aws-amplify/ui-react/dist/esm/index.js 13:0-60 13:0-60
# ./src/App.js 9:0-58
# ./src/index.js 8:0-24 16:33-36
maplibre-gl-js-amplify is a dependency, though not one I am even using.
I notice in the error that it's referencing the "C:\projects\amplify-project\node_modules#aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify\src" directory.
However, when I navigate to "C:\projects\amplify-project\node_modules#aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify", there IS no src directory!
The "C:\projects\amplify-project\node_modules#aws-amplify\ui-react\node_modules\maplibre-gl-js-amplify" directory only has dist and lib directories.
When researching, I looked at the github repo and see there is a src directory but no dist or lib directories, with different files in the file structure:
https://github.com/aws-amplify/maplibre-gl-js-amplify
I don't know if the recent changes to aws-amplify caused this new issue or not but bottom line is, it appears that Amplify is calling resources in the src directory erroneously, or is referencing the development version of this repo and not the distribution version.
Any ideas on why this is happening and how to fix?

Related

Why is `eas` ignoring my `package.json` when building my project? Specifically, the `bundleIdentifier` is not being found

When running eas build --platform ios from Expo, I get the following error your project must have a bundleidentifier set in the expo config (app.json or app.config.js)., but I do have a bundleIdentifier set in app.json, under expo.ios.bundleIdentifier.
This guide was helpful in debugging.
In my case, it turned out my app.json file was in my .gitignore (because it's code genned from other files in my project so I don't want it committed), and eas doesn't upload files that are .gitignored.
I therefore solved it by introducing a .easignore in the root of my directory that did not exclude app.json.

Adding a JSON data file to GCP Dataflow package and using it inside the code

I want to add a JSON file to my Dataflow (Apache Beam) package and use it inside the code.
I've seen several questions on Stack Overflow with different answers, and I tried the recommended approach with a MANIFEST.in and adding data_files to the setup.py file. But nothing I tried works for me.
Here is my current setup.
(I have mapping.json in both the common folder and the root folder for testing purposes.)
MANIFEST.in
recursive-include common *.json
setup.py
import setuptools
setuptools.setup(
packages=setuptools.find_packages(),
data_files=[
("common", ["mapping.json"])
],
include_package_data=True,
install_requires=[
'apache-beam[gcp]==2.31.0',
'python-dateutil==2.8.1'
],
)
Using the file inside common/config.py
import json
from pathlib import Path
def _load_category_theme_mapping(file_name):
path = Path(__file__).parent / file_name
with path.open('r', encoding='utf-8') as file:
return json.load(file)
mapping = _load_category_theme_mapping("mapping.json")
I'm using Flex Templates to run my Dataflow job and I copy the common folder to the target common folder.
When I run the Dataflow job with this setup, it just throws an error.
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/site-packages/common/category_theme_mapping.json'
I tried moving the .json file outside of the common folder (into the root folder) and changed the code (and the Dockerfile) accordingly to read from the base folder.
Then I changed the setup.py file to have the data_files to (".", ["mapping.json"] and MANIFEST.in to have include *.json, but it still fails.
I also tried without having a MANIFEST.in, but then the launcher fails without any informative log.
Any idea what I'm doing wrong?

polymer cli Promise rejection: Error: ENOENT: no such file or directory, open

How to debug polymer-cli polymer build.
during a build process i got an error
Promise rejection: Error: ENOENT: no such file or directory, open
I assume it is because some dependencies between packages but i don't know how to debug the build process to find out which package causes it.
The proflem is with
'/bower_components/paper-styles/element-styles/paper-material.html'
in my version I have
'/bower_components/paper-styles/element-styles/paper-material-styles.html'
Search your project as well as your bower_components directory for any references to paper-material.html and replace them with paper-material-styles.html (if there are references to that in your bower_components directory, hopefully you just have to update whatever component that is to its latest version). The file was renamed to address a bug, see https://github.com/PolymerElements/paper-styles/issues/130

linking ember-cli master causes merge errors

I have followed the ember-cli instructions for referencing the master branch in development.
It works fine when I use a new ember project.
However when I try linking to an existing ember project i get this kind of error:
Merge error: file "bootstrap/.bower.json" exists in vendor and vendor - pass option { overwrite: true } to mergeTrees in order to have the latter file win
I have tried everything to get rid of this (i.e. clone repository, and initialize things one step at a time.
The occurs once I install stefanpenner/loader.js#1.0.1
Fundamental problem is that vendor directory has changed to bower_components directory.
this leaves the .bowerrc file pointing to "vendor" which seems to cause the problem.
make sure to - delete .bowerrc file or update it so it points to bower-components
This will happen as long as you do everything in the right order
go to directory containing your working copy (master) of ember-cli
npm link
go to your code directory
npm link ember-cli
ember init (make sure to update .bowerrc, and update/merge .gitignore, bower.json, package.json)
you should be good to go
The problem I was having was running bower install BEFORE ember init (per the ember-cli web page)
This was installing stuff in the vendor directory, so you end up with duplicates.

ImportError: No module named for my code on Readthedocs

I am trying to link my Sphinx documentation with ReadtheDocs. I can build the documentation locally but when I try to have ReadtheDocs automatically generate the documentation I get the following error:
Sphinx Standard Error
Making output directory...
Exception occurred:
File "/var/build/user_builds/mousedb/checkouts/latest/Docs/source/conf.py", line 25, in <module>
from mousedb import settings
ImportError: No module named mousedb
The full traceback has been saved in /tmp/sphinx-err-n_8fkR.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
My project name is mousedb. I don't understand why I get this import error in the auto-build but not locally.
Update
Based on the comments I think that this is an issue for importing my settings file into a sibling Docs directory. Rather than doing an absolute import (as I had been doing) I should be doing a relative import based on the location of settings.py and conf.py.
I want to import my settings file into my conf.py with the following directory structure:
-mousedb
--settings.py
-Docs
--source
---conf.py
--build
You originally talked about a "local absolute path to my code" and now about setting up relative paths to your code. This probably means you're not using a setup.py file and also not a virtualenv.
In the same directory as Docs/ and mousedb/, add a setup.py:
from setuptools import setup
setup(name='mousedb',
version='0.1',
description="My sample package",
long_description="",
author='TODO',
author_email='todo#example.org',
license='TODO',
packages=['mousedb'],
zip_safe=False,
install_requires=[
'Django',
# 'Sphinx',
# ^^^ Not sure if this is needed on readthedocs.org
# 'something else?',
],
)
After committing/pushing/whatever this file, you can go to your readthedocs settings for your project. Enable the "use virtualenv" setting. This will "nstall your project inside a virtualenv using setup.py install".
The end result is that everything python-related that readthedocs does will have your project in it's sys.path.
The probable cause of your problems is that you run sphinx from within your "root" directory on your local system, where python magically finds the mousedb/ package in your current directory. But readthedocs apparently runs it from within the Docs/ directory and thus cannot find mousedb.