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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

GuessJS does not work with Firebase Analytics 馃 #401

Open
JandroMejia97 opened this issue May 20, 2020 · 0 comments
Open

GuessJS does not work with Firebase Analytics 馃 #401

JandroMejia97 opened this issue May 20, 2020 · 0 comments

Comments

@JandroMejia97
Copy link

GuessJS currently does not work with Firebase Analytics.
When I run 'ng build --prod' I get the following message 'UnhandledPromiseRejectionWarning: Error: user does not have sufficient permissions for this profile'.

This is my setting in 'extend.webpack.config.js':

const { GuessPlugin } = require('guess-webpack');
const { parseRoutes } = require('guess-parser');

const credentials = require('./secret/credentialsF.json');
const viewId = 'viewID';

module.exports = {
  plugins: [
    new GuessPlugin({
      debug: true,
      jwt: credentials,
      GA: viewId,
      runtime: {
        delegate: false
      },
      routeProvider() {
        return parseRoutes('.');
      }
    })
  ]
};

This is the message from the terminal

GaxiosError: User does not have sufficient permissions for this profile.
    at Gaxios._request (/home/mejia97/Documentos/CTM/ctm-front/node_modules/gaxios/build/src/gaxios.js:85:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async JWT.requestAsync (/home/mejia97/Documentos/CTM/ctm-front/node_modules/google-auth-library/build/src/auth/oauth2client.js:340:18) {
  response: {
    config: {
      url: 'https://analyticsreporting.googleapis.com/v4/reports:batchGet',
      method: 'POST',
      paramsSerializer: [Function (anonymous)],
      data: [Object],
      headers: [Object],
      params: [Object: null prototype] {},
      validateStatus: [Function (anonymous)],
      retry: true,
      body: '{"reportRequests":{"pageSize":10000,"viewId":"VIEWID","dateRanges":[{"startDate":"2019-05-21","endDate":"2020-05-20"}],"dimensions":[{"name":"ga:previousPagePath"},{"name":"ga:pagePath"}],"metrics":[{"expression":"ga:pageviews"}],"orderBys":[{"fieldName":"ga:pageviews","sortOrder":"DESCENDING"}]}}',
      responseType: 'json',
      retryConfig: [Object]
    },
    data: { error: [Object] },
    headers: {
      'alt-svc': 'h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
      'cache-control': 'private',
      connection: 'close',
      'content-encoding': 'gzip',
      'content-type': 'application/json; charset=UTF-8',
      date: 'Wed, 20 May 2020 16:04:20 GMT',
      server: 'ESF',
      'transfer-encoding': 'chunked',
      vary: 'Origin, X-Origin, Referer',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'SAMEORIGIN',
      'x-xss-protection': '0'
    },
    status: 403,
    statusText: 'Forbidden',
    request: {
      responseURL: 'https://analyticsreporting.googleapis.com/v4/reports:batchGet'
    }
  },
  config: {
    url: 'https://analyticsreporting.googleapis.com/v4/reports:batchGet',
    method: 'POST',
    paramsSerializer: [Function (anonymous)],
    data: { reportRequests: [Object] },
    headers: {
      'x-goog-api-client': 'gdcl/4.1.1 gl-node/13.7.0 auth/6.0.0',
      'Accept-Encoding': 'gzip',
      'User-Agent': 'google-api-nodejs-client/4.1.1 (gzip)',
      Authorization: 'Bearer TOKEN',
      'Content-Type': 'application/json',
      Accept: 'application/json'
    },
    params: [Object: null prototype] {},
    validateStatus: [Function (anonymous)],
    retry: true,
    body: '{"reportRequests":{"pageSize":10000,"viewId":"VIEWID","dateRanges":[{"startDate":"2019-05-21","endDate":"2020-05-20"}],"dimensions":[{"name":"ga:previousPagePath"},{"name":"ga:pagePath"}],"metrics":[{"expression":"ga:pageviews"}],"orderBys":[{"fieldName":"ga:pageviews","sortOrder":"DESCENDING"}]}}',
    responseType: 'json',
    retryConfig: {
      currentRetryAttempt: 0,
      retry: 3,
      httpMethodsToRetry: [Array],
      noResponseRetries: 2,
      statusCodesToRetry: [Array]
    }
  },
  code: 403,
  errors: [
    {
      message: 'User does not have sufficient permissions for this profile.',
      domain: 'global',
      reason: 'forbidden'
    }
  ]
}
(node:6954) UnhandledPromiseRejectionWarning: Error: User does not have sufficient permissions for this profile.
    at Gaxios._request (/home/mejia97/Documentos/CTM/ctm-front/node_modules/gaxios/build/src/gaxios.js:85:23)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async JWT.requestAsync (/home/mejia97/Documentos/CTM/ctm-front/node_modules/google-auth-library/build/src/auth/oauth2client.js:340:18)
(node:6954) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6954) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I think this error is due to Firebase Analytics not allowing you to create views. This is my settings in Analytics.

image

I don't know if I have misconfigured something or if it is an unimplemented functionality, in that case, it would be very useful to support this. Beforehand thank you very much 馃檪馃檪.

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

1 participant