Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to get Ads Pixels fails due to unsupported field sent to API #357

Open
lombritz opened this issue Sep 28, 2021 · 2 comments
Open

Call to get Ads Pixels fails due to unsupported field sent to API #357

lombritz opened this issue Sep 28, 2021 · 2 comments

Comments

@lombritz
Copy link

Which SDK version are you using?

v12.0

What's the issue?

Call to API endpoint /adspixels does not support field owner_ad_account as of API v12.0 however when using SDK to request the Ads Pixels this field is still included on the array of all FIELDS supported by this endpoint in the request inner class named APIRequestGetAdsPixels on AdAccount.

Steps/Sample code to reproduce the issue

Code snippet doing this call:

    @Override
    public List<AdsPixel> getPixels(AdAccount adAccount) {
        try {
            CachedPixel cachedPixel = cachedPixelsRepository.findById(adAccount.getFieldId()).orElse(null);
            if (isNull(cachedPixel) || isEmpty(cachedPixel.getPixels())) {
                List<String> pixelJson = adAccount
                        .getAdsPixels()
                        .requestAllFields() // <<<<---- This line should include all supported fields, but SDK adds an unsupported
                        .execute()
                        .stream()
                        .map(AdsPixel::toString)
                        .collect(toList());

                cachedPixel = new CachedPixel(adAccount.getFieldId(), pixelJson);
                cachedPixelsRepository.save(cachedPixel);
            }
            return cachedPixel.getPixels().stream()
                    .map(json -> loadJSON(json, adAccount.getContext(), adAccount.getHeader()))
                    .collect(toList());
        } catch (APIException exc) {
            throw new FacebookApiException(exc);
        }
    }

Observed Results:

  • What happened? This could be a description, log output, etc.

I receive an error "Missing Permissions" which is misleading given the fact the issue is not permissions related according to FB developer support.

Here is the stacktrace:

io.metadata.commons.exception.FacebookApiException: {"error":{"message":"(#100) Missing permissions","type":"OAuthException","code":100,"fbtrace_id":"AFmFzV2g33DXAe0JrosW2gd"}}
    at io.metadata.channel.facebook.FacebookServiceImpl.preIntegrationValidation(FacebookServiceImpl.java:225)
    at io.metadata.channel.facebook.FacebookServiceImpl$$FastClassBySpringCGLIB$$78120229.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
    at io.metadata.channel.facebook.FacebookServiceImpl$$EnhancerBySpringCGLIB$$655e3c37.preIntegrationValidation(<generated>)
    at io.metadata.api.controllers.ChannelAuthorizationController.saveFacebookAccount(ChannelAuthorizationController.java:157)
    at io.metadata.api.controllers.ChannelAuthorizationController$$FastClassBySpringCGLIB$$c9641534.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
    at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:123)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)
    at io.metadata.api.controllers.ChannelAuthorizationController$$EnhancerBySpringCGLIB$$2bb16baa.saveFacebookAccount(<generated>)
    at jdk.internal.reflect.GeneratedMethodAccessor2098.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:517)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:584)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:228)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at io.metadata.api.security.LoggingFilter.doFilter(LoggingFilter.java:115)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at io.metadata.api.security.AuthenticationFilter.doFilter(AuthenticationFilter.java:158)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.owasp.esapi.filters.SecurityWrapper.doFilter(SecurityWrapper.java:107)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at io.metadata.api.utils.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:40)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:89)
    at org.springframework.cloud.sleuth.autoconfig.instrument.web.LazyTracingFilter.doFilter(TraceWebServletConfiguration.java:114)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: io.metadata.commons.exception.FacebookApiException: {"error":{"message":"(#100) Missing permissions","type":"OAuthException","code":100,"fbtrace_id":"AFmFzV2g33DXAe0JrosW2gd"}}
    at io.metadata.channel.facebook.FacebookServiceImpl.getPixels(FacebookServiceImpl.java:461)
    at io.metadata.channel.facebook.FacebookServiceImpl.createPixelIfNotExist(FacebookServiceImpl.java:550)
    at io.metadata.channel.facebook.FacebookServiceImpl.preIntegrationValidation(FacebookServiceImpl.java:220)
    ... 99 common frames omitted
Caused by: com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"(#100) Missing permissions","type":"OAuthException","code":100,"fbtrace_id":"AFmFzV2g33DXAe0JrosW2gd"}}
    at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:309)
    at com.facebook.ads.sdk.APIRequest.access$100(APIRequest.java:52)
    at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.sendGet(APIRequest.java:535)
    at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.execute(APIRequest.java:519)
    at io.metadata.channel.facebook.sdk.FacebookRequestExecutorWrapper.execute(FacebookRequestExecutorWrapper.java:34)
    at com.facebook.ads.sdk.APIRequest.executeInternal(APIRequest.java:197)
    at com.facebook.ads.sdk.AdAccount$APIRequestGetAdsPixels.execute(AdAccount.java:8502)
    at com.facebook.ads.sdk.AdAccount$APIRequestGetAdsPixels.execute(AdAccount.java:8497)
    at io.metadata.channel.facebook.FacebookServiceImpl.getPixels(FacebookServiceImpl.java:449)
    ... 101 common frames omitted
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v12.0/act_236174004540362/adspixels?access_token=EAAWiuy8FkF0BAPRDENygWmPCx20vocI52pbsg7sA394LD7QZCZBmkAn5foWP5ZBmi2QjDxBfvfNL0t8aN5IiVSSUClXiZCDEGHm9crZAjAaX9CDUqzLOKGZAVgtV49t8M6ZCMDApJecwAlZAiu8ZBPVQ83mu50EXqS03N3qZCiFxhZBY09pGGRSyyySkC5WLEMJSJ0di3EwgvINJKZCLSvdhIKWVlJE5zncags5xNibrBFsjj3Py5o9JFYChjBtUnRSThPjT5zwEy4WVjEaDZADzLhygg&appsecret_proof=6fa82ac344db11d278d0e48c16681d35a45e24ab7653a15b1660d2686a7c6cc5&fields=automatic_matching_fields%2Ccan_proxy%2Ccode%2Ccreation_time%2Ccreator%2Cdata_use_setting%2Cenable_automatic_matching%2Cfirst_party_cookie_status%2Cid%2Cis_created_by_business%2Cis_crm%2Cis_unavailable%2Clast_fired_time%2Cname%2Cowner_ad_account%2Cowner_business
    at java.base/jdk.internal.reflect.GeneratedConstructorAccessor311.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:290)
    ... 109 common frames omitted
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v12.0/act_236174004540362/adspixels?access_token=EAAWiuy8FkF0BAPRDENygWmPCx20vocI52pbsg7sA394LD7QZCZBmkAn5foWP5ZBmi2QjDxBfvfNL0t8aN5IiVSSUClXiZCDEGHm9crZAjAaX9CDUqzLOKGZAVgtV49t8M6ZCMDApJecwAlZAiu8ZBPVQ83mu50EXqS03N3qZCiFxhZBY09pGGRSyyySkC5WLEMJSJ0di3EwgvINJKZCLSvdhIKWVlJE5zncags5xNibrBFsjj3Py5o9JFYChjBtUnRSThPjT5zwEy4WVjEaDZADzLhygg&appsecret_proof=6fa82ac344db11d278d0e48c16681d35a45e24ab7653a15b1660d2686a7c6cc5&fields=automatic_matching_fields%2Ccan_proxy%2Ccode%2Ccreation_time%2Ccreator%2Cdata_use_setting%2Cenable_automatic_matching%2Cfirst_party_cookie_status%2Cid%2Cis_created_by_business%2Cis_crm%2Cis_unavailable%2Clast_fired_time%2Cname%2Cowner_ad_account%2Cowner_business
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.base/java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:287)

Expected Results:

  • What did you expect to happen?

I expect to receive the AdsPixel object from which I pretend to extract the JSON (toString()) and cache for my application purposes.

@stale
Copy link

stale bot commented Jan 9, 2022

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Jan 9, 2022
@osib-c
Copy link

osib-c commented Jan 14, 2022

Hi,

This seems to be similar to the issue I just reported:
#369

You could try using the Graph API Explorer to figure out which exact field is causing the issue.

While I cannot verify this at the moment, I guess a workaround would be to request all the required field specifically and ommitting the problematic one, instead of using the '.requestAllFields()'.

@stale stale bot removed the Stale label Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants