Hello all, i have added all the required config fo...
# plugins-general
m
Hello all, i have added all the required config for my tap-bing-ads, but still facing this issue, the same config works in singer tap.. i also revert the version of bingads but still face this issue.. tap-bing-ads -> target-postgres Target properly configured..
Copy code
bingads.exceptions.OAuthTokenRequestException: error_code: invalid_grant, error_description: The request was denied because one or more scopes requested are unauthorized or expired. The user must first sign in and grant the client application access to the requested scope.
d
@mohsin Can you show the configuration Meltano is using by running
meltano config tap-bing-ads
? Is that the exact same config that you're saying works when using the Singer tap by itself?
m
Copy code
{
  "developer_token": "*****",
  "oauth_client_id": "******8",
  "oauth_client_secret": "******",
  "refresh_token": **************",
  "customer_id": "******",
  "account_ids": "********",
  "start_date": "2021-03-05T00:00:00Z"
}
@douwe_maan here is the output after the config command
is required_live_connect required?
d
It defaults to
True
, so it being left out should be OK: https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/__init__.py#L107
If you run the tap directly with that output as the config file, are you not hitting the same error? Or did you mean something else with "the same config works in singer tap"?
Note also that we are planning to make https://github.com/wheelhousedev/tap-bing-ads the new default fork for tap-bing-ads (https://gitlab.com/meltano/meltano/-/issues/2617), so you may want to switch to that one already. It doesn't look related to this issue, though.
m
i applied the same config work fine in singer tap, when i remove the require_live_connect and redirect_uri so same error through but added these params, it works fine
what should i have to do?
d
So the exact output of
meltano config tap-bing-ads
works when passed directly
tap-bing-ads
using
--config
, but not when Meltano passes it? Is there a dollar sign in any of those tokens and secrets, by any chance?
If you like, I can jump on a quick Zoom call with you to see the situation for myself, that may help me spot what's different!
m
yeah sure we can do
d
@aditya_sastry It looks like Mohsin is having trouble generating valid tokens/credentials for Bing Ads API. Do you happen to remember the process you followed that worked?
Do you happen to remember which scopes you had to request, since that appears to be the issue according to the error message?
a
This one worked fairly well with the following config. I'm planning to switch the endpoint on the wheelhousdev repo from Microsoft Live to IDP when I get some engineering capacity which should help with this. 1. You definitely want
require_live_connect: false
in your meltano.yml, I couldn't get the live connect endpoint to work for me when set to
true
2. If you're using the code grant flow (refresh token) you should not need a Redirect URI OAuth Scopes: _`scope=openid%20profile%20https://ads.microsoft.com/ads.manage%20offline_access`_ @mohsin - Happy to hop on a call as well to see if I can help
d
@aditya_sastry thanks! We should get this documented, I’ll make a note of that
m
@aditya_sastry Thanks for sharing your words, i will revert r`equire_live_connect: true to false` , second do you have any idea why bing endpoint won’t return the refresh token When i hit this endpoint: https://login.microsoftonline.com/common/oauth2/v2.0/token will face the below error,
Copy code
"error_description": "AADSTS70000: The provided value for the 'code' parameter is not valid. The code has expired.\r\nTrace ID: c48a954a-3f49-459a-bd49-3478995d6300\r\nCorrelation ID: a6b615f7-116a-4587-bfa0-93e89a51545e\r\nTimestamp: 2021-03-04 23:12:00Z",
@aditya_sastry do we have need to specify the scope in our meltano.yaml file?
Yeah sure we do a call, please let me know when you will be available
@douwe_maan did you get any info?
a
You need the scope in the refresh token request, not the meltano.yml^ https://docs.microsoft.com/en-us/advertising/guides/get-started?view=bingads-13
m
yeah yeah i am not specifying the scope in meltano.yml
d
I've created a new issue about the incomplete docs: https://gitlab.com/meltano/meltano/-/issues/2630
t
I’ve made a quick MR to update the docs based on my understanding of this thread. @aditya_sastry or @mohsin can you review when you get a chance? https://gitlab.com/meltano/meltano/-/merge_requests/2092/diffs
m
@taylor sure i’ll look at it
@taylor looks fine now. Thanks for the update
t
thanks for checking!
m
@taylor can you please the requireliveconnect to
False
not
false
, second the bing-api python doesn’t consider this params. Still consider the requireLiveconnect to
True
checkout this i set my
requireLiveconnect
into meltano.yml file, but the change not affect into the package. I debug the bingads package and find out the value of
requireLiveconnect
still show me True which produce an error
Copy code
bingads.exceptions.OAuthTokenRequestException: error_code: invalid_grant, error_description: The request was denied because one or more scopes requested are unauthorized or expired. The user must first sign in and grant the client application access to the requested scope.
is this error from meltano side or bing ads ?
cc: @edward_ryan @gunnar
t
@mohsin I’m not sure I understand your request about
requireliveconnect
. Are you saying the documentation needs to be updated here https://meltano.com/plugins/extractors/bing-ads.html#require-live-connect ? Looking at https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/__init__.py#L107 it’s fetching
require_live_connect
so that’s what would need to be passed in.
m
yes you updated correctly but unfortunately this will not create any impact if we set
require_live_connect
t
oh looks like that’s b/c they’re passing in
REQUIRED_CONFIG_KEYS
here which filters and config being passed through
that’s annoying.
so the options here areto make a PR to the tap to get that updated or fork the project 😕
m
yes it is annonying we have to manually added the require_live_connect value into the package, this is not the correct approach can you please guide me how can i raise a request on this?
1. ad_extension_detail_report.* 2. campaign_performance_report.* Also these two streams through incremental state error ```target-redshift (out) | {"bookmarks": {"accounts": {"last_record": "2021-02-23T212900.960000+00:00"}, "141559394_ad_extension_detail_report": {"request_id": null, "date": "2021-03-19T000000+00:00"}, "141559394_ad_performance_report": {"request_id": "1238134853920"}, "141559394_age_gender_audience_report": {"request_id": "1238134853947"}, "141559394_audience_performance_report": {"request_id": "1238134853965"}, "141559394_keyword_performance_report": {"request_id": "1238134853997"}}} meltano | INFO Incremental state has been updated at 2021-03-19 220602.556205. meltano | DEBUG Incremental state: {'bookmarks': {'accounts': {'last_record': '2021-02-23T212900.960000+00:00'}, '141559394_ad_extension_detail_report': {'request_id': None, 'date': '2021-03-19T000000+00:00'}, '141559394_ad_performance_report': {'request_id': '1238134853920'}, '141559394_age_gender_audience_report': {'request_id': '1238134853947'}, '141559394_audience_performance_report': {'request_id': '1238134853965'}, '141559394_keyword_performance_report': {'request_id': '1238134853997'}}} meltano | DEBUG Deleted configuration at /home/ubuntu/dev-meltano/bing-to-postgres/meltan-bing-to-redshift/bing-ads-to-redshift/.meltano/run/elt/2021-03-19T220443--tap-bing-ads--target-redshift/4aec8e37-5ffb-4dbf-80b0-1085cf559bee/target.config.json meltano | DEBUG Deleted configuration at /home/ubuntu/dev-meltano/bing-to-postgres/meltan-bing-to-redshift/bing-ads-to-redshift/.meltano/run/elt/2021-03-19T220443--tap-bing-ads--target-redshift/4aec8e37-5ffb-4dbf-80b0-1085cf559bee/tap.config.json meltano | ERROR Extraction failed (1): } meltano | DEBUG ELT could not be completed: Extractor failed Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/cli/elt.py", line 236, in _run_elt await _run_extract_load(elt_context, output_logger) File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/cli/elt.py", line 274, in _run_extract_load await singer_runner.run( File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/core/runner/singer.py", line 253, in run await self.invoke( File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/core/runner/singer.py", line 227, in invoke raise RunnerError("Extractor failed", {PluginType.EXTRACTORS: tap_code}) meltano.core.runner.RunnerError: Extractor failed The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/cli/elt.py", line 224, in _redirect_output yield File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/cli/elt.py", line 245, in _run_elt raise CliError(f"ELT could not be completed: {err}") from err meltano.cli.utils.CliError: ELT could not be completed: Extractor failed meltano | ELT could not be completed: Extractor failed [2021-03-19 220602,667] [38353|MainThread|meltano.cli.utils] [DEBUG] ELT could not be completed: Extractor failed Traceback (most recent call last): File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/cli/elt.py", line 236, in _run_elt await _run_extract_load(elt_context, output_logger) File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/cli/elt.py", line 274, in _run_extract_load await singer_runner.run( File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/core/runner/singer.py", line 253, in run await self.invoke( File "/home/ubuntu/.local/lib/python3.8/site-packages/meltano/core/runner/singer.py", line 227, in invoke raise RunnerError("Extractor failed", {PluginType.EXTRACTORS: tap_code}) meltano.core.runner.RunnerError: Extractor failed The above exception was the direct cause of the following exception:
t
guide me how can i raise a request on this
you can make a pull request on GitHub to update https://github.com/singer-io/tap-bing-ads/blob/master/tap_bing_ads/__init__.py#L27-L35 to include the
require_live_connect
config. it seems they’re fairly unresponsive to PRs though so forking it and fixing it yourself may be a solution.
Based on the errors you’ve shared I’m not sure where the failure would be coming from. Is there any failure earlier in the log output? It’s saying the extractor failed so maybe a specific stream failed but everything else succeeded?
m
yeah i think stream failed