brian_plexico
09/25/2023, 5:02 PMversion: 1
default_environment: dev
project_id: 84ee0daa-98cb-442b-ac54-d65f476bfd32
environments:
- name: dev
config:
plugins:
extractors:
- name: tap-rest-api-msdk
config:
api_url: https://<sub>.<domain>.com/default.aspx
streams:
- name: default
- name: staging
- name: prod
plugins:
extractors:
- name: tap-rest-api-msdk
variant: widen
pip_url: tap-rest-api-msdk
config:
api_url: https://<sub>.<domain>.com/default.aspx
params:
credentials:
org: <pass in org value>
username: <pass in username value>
password: <pass in password value>
database: <pass in db name>
use_request_body_not_params: true
streams:
- name: default
loaders:
- name: target-jsonl
variant: andyh1203
pip_url: target-jsonl
I'm receiving the following error when running meltano config tap-rest-api-msdk test
:
```[info ] The default environment 'dev' will be ignored for meltano config
. To configure a specific environment, please use the option --environment=<environment name>
.
Need help fixing this problem? Visit http://melta.no/ for troubleshooting steps, or to
join our friendly Slack community.
Plugin configuration is invalid
Catalog discovery failed: command ['/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/bin/tap-rest-api-msdk', '--config', '/Users/bplexico/dev/meltano-projects/testetl/.meltano/run/tap-rest-api-msdk/tap.8c88e553-e803-4657-8680-fc124c9b2a64.config.json', '--discover'] returned 1 with stderr:
2023-09-25 125517,654 | INFO | tap-rest-api-msdk | No schema found. Inferring schema from API call.
Traceback (most recent call last):
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 3 column 1 (char 4)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/bin/tap-rest-api-msdk", line 8, in <module>
sys.exit(TapRestApiMsdk.cli())
^^^^^^^^^^^^^^^^^^^^
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/click/core.py", line 1077, in main
with self.make_context(prog_name, args, **extra) as ctx:
^^^^^^^^^^^^^^^^^^^^^^^…lukasz_prasol
09/25/2023, 5:15 PM'
in the curl
command. Another thing is if the json validates properly (any "
in the password?)brian_plexico
09/25/2023, 5:33 PM'
was just from copy/paste. It's there in Postman and the curl command properly returns data.
I included it to show exactly what works in case that helps someone point me in the correct direction with regard to the tap config.lukasz_prasol
09/25/2023, 5:54 PMFile "/Users/bplexico/dev/meltano-projects/testetl/.meltano/extractors/tap-rest-api-msdk/venv/lib/python3.11/site-packages/requests/models.py", line 971
set a debugger there and check what is the issue.
This may be the tap temporary file /Users/bplexico/dev/meltano-projects/testetl/.meltano/run/tap-rest-api-msdk/tap.8c88e553-e803-4657-8680-fc124c9b2a64.config.json
and maybe it'll show what's wrong with the tap configuration, if some value is missing. Just making my best guess here 🙂steve_clarke
09/25/2023, 9:38 PMexport TAP_REST_API_MSDK_STREAMS='[{"name": "default", "params": {"credentials": { "org": "<pass in org value>", "username": "<pass in username>", "password":"<pass in password>" }}, "path": "/", "primary_keys": []}]'
Then try running in debug mode to see the requests going through and what is being generated.
E.g.
meltano --log-level=debug invoke tap-rest-api-msdk --discover
steve_clarke
09/26/2023, 4:31 AM<http://self.logger.info|self.logger.info>(f"{records_path=}")
<http://self.logger.info|self.logger.info>(f"{r=}")
brian_plexico
09/26/2023, 4:44 PMsend: b'GET /Default.aspx?ReturnUrl=%2Fdefault.aspx%2F%3Fcredentials%3Dorg%26credentials%3Dusername%26credentials%3Dpassword&credentials=org&credentials=username&credentials=password
If I add the logging in tap.py
the response code is returned as 200 but the actual text sent back is the html of default.aspx
which means the authentication didn't work which isn't suprising given the way the params are passed to the API.brian_plexico
09/26/2023, 7:53 PMdata=
attribute is unable to accept nested params. You have to use json=
instead.
See an explanation here.
this works
r = requests.get(
"https://<sub>.<domain>.com/default.aspx",
json={
"credentials": {"org": "<org_value>", "username": "<username_value>", "password": "<password_value>"},
"database": "<database_value>">,
"type": "<type_value>",
},
)
but tap.py is only using data=
r = requests.get(
self.config["api_url"] + path,
auth=self.http_auth,
data=params,
headers=headers,
)
tap.py#58steve_clarke
09/27/2023, 9:21 AMparams=params,
to
json=params,
Does that allow authentication with a complex nested dictionary? Can you ingest data?
If this doesn't work, it would appear that an additional authentication method is required to accept your authentication parameters and have an option to send them as part of the body request. This would need to be a PR to the current tap-rest-api-msdk.steve_clarke
09/27/2023, 9:36 AMbrian_plexico
09/27/2023, 3:42 PMparams=
to json=
and it still isn't working. 🤷