Error for Plugin configuration of attributes with '' as the default value
Error description
If I try to add a default value of ''
in the discovery.yml
entry for Google Analytics, I get an error by the Plugin Discovery Service.
INFO:meltano.api.app:[http://localhost:5000/api/v1/plugins/all] as <meltano.api.security.identity.FreeUser object at 0x11608a6a0>
ERROR:flask.app:Exception on /api/v1/plugins/installed [GET]
Traceback (most recent call last):
... ... ...
File "/Users/iroussos/work/meltano/src/meltano/core/plugin_discovery_service.py", line 161, in find_plugin
for plugin in self.plugins()
File "/Users/iroussos/work/meltano/src/meltano/core/plugin_discovery_service.py", line 135, in plugins
custom_plugins = self.make_plugins(self.project.meltano.get("plugins", {}))
AttributeError: 'NoneType' object has no attribute 'get'
This happens if add a default value either for the reports
or the end_date
attributes:
- name: tap-google-analytics
namespace: tap_google_analytics
docs: 'https://meltano.com/plugins/extractors/google-analytics.html'
pip_url: 'git+https://gitlab.com/meltano/tap-google-analytics.git'
settings_group_validation:
- ['key_file_location', 'view_id', 'start_date']
settings:
- name: key_file_location
env: GOOGLE_ANALYTICS_API_CLIENT_SECRETS
kind: file
value: 'client_secrets.json'
- name: view_id
env: GOOGLE_ANALYTICS_API_VIEW_ID
label: View ID
- name: reports
env: GOOGLE_ANALYTICS_API_REPORTS
+ value: ''
- name: start_date
env: GOOGLE_ANALYTICS_API_START_DATE
kind: date_iso8601
- name: end_date
env: GOOGLE_ANALYTICS_API_END_DATE
+ value: ''
kind: date_iso8601
In the case of end_date
I get the error the moment I try to install the Tap and the configuration modal never opens.
In the case of reports
, the Tap installs successfully, I can set it up but then something is not properly saved and when the elt runs I get incorrect behavior (like the tap run on defaults). Also the Entity Selection modal never opens, which means that the Tap can not properly run its discovery.
This is strange cause I don't get the same error on Tap Gitlab where we also have default values for projects and I can leave them as they are without issues.
Way to reproduce:
-
Initialize a new meltano project
meltano init test_tap_google_analytics cd test_tap_google_analytics
-
Copy the
discovery.yml
from your cloned Meltano project you use for developement to your Meltano project.For example, in my case:
cp ~/work/meltano/src/meltano/core/bundle/discovery.yml ./
-
Update the
tap-google-analytics
entry with the following:
- name: tap-google-analytics
namespace: tap_google_analytics
docs: 'https://meltano.com/plugins/extractors/google-analytics.html'
pip_url: 'git+https://gitlab.com/meltano/tap-google-analytics.git'
settings_group_validation:
- ['key_file_location', 'view_id', 'start_date']
settings:
- name: key_file_location
env: GOOGLE_ANALYTICS_API_CLIENT_SECRETS
kind: file
value: 'client_secrets.json'
- name: view_id
env: GOOGLE_ANALYTICS_API_VIEW_ID
label: View ID
- name: reports
env: GOOGLE_ANALYTICS_API_REPORTS
value: ''
- name: start_date
env: GOOGLE_ANALYTICS_API_START_DATE
kind: date_iso8601
- name: end_date
env: GOOGLE_ANALYTICS_API_END_DATE
value: ''
kind: date_iso8601
-
Run Meltano UI
-
Add
tap-google-analytics
and check the error -
You can start over and remove the default value from
end_date
and check what happens with thereports
attribute.