Grafana Faro no Loging Custom Errors or Logs

  • What Grafana version and what operating system are you using?
    @grafana/faro-react”: “1.0.5”,
    @grafana/faro-web-sdk”: “1.0.5”,
    @grafana/faro-web-tracing”: “1.0.5”,

  • What are you trying to achieve?
    I am trying to log custom errors and logs.

  • How are you trying to achieve it?
    In a react component I am testing it doing this:

  const error = new Error('I am supposed to fail')
  useEffect(() => {
    if (error) {
      faro.api.pushError(error)
      faro.api.pushError(error)
      console.log(error)
    } else {
      console.log('nada')
    }
  }, [])
  • What happened?
    No error is being logged in the Faro Frontend dashboard

  • What did you expect to happen?
    That I am supposed to fail appears

  • Can you copy/paste the configuration(s) that you are having problems with?

const faroConfig = () => {
    return initializeFaro({
      url:
        'https://faro-collector-prod-eu-west-0.grafana.net/collect/12a30458c583a089c9de7f10677e5c2b',
      app: {
        name: 'agents',
        version: ` v ${runtimeConfig.version}`,
        environment: runtimeConfig.environment,
      },
      instrumentations: [
        ...getWebInstrumentations(),
        new TracingInstrumentation(),
        new ReactIntegration({
          router: {
            version: ReactRouterVersion.V5,
            dependencies: {
              history,
              Route,
            },
          },
        }),
      ],
    })
  }
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    I have seen in web-browser console log this error:
@grafana/faro-web-sdk:transport-fetch
 TypeError: item.forEach is not a function
    at getTransportBody (utils.ts:47:1)
    at transport.ts:41:1
    at work (promiseBuffer.ts:34:1)
    at promiseBuffer.ts:64:1
    at new ZoneAwarePromise (zone.js:1428:1)
    at Object.add (promiseBuffer.ts:58:1)
    at FetchTransport.<anonymous> (transport.ts:40:1)
    at Generator.next (<anonymous>)
    at index.ts:1:1
    at new ZoneAwarePromise (zone.js:1428:1)
    at push.../../../../node_modules/.pnpm/@grafana+faro-web-sdk@1.0.5/node_modules/@grafana/faro-web-sdk/dist/esm/transports/fetch/transport.js.__awaiter (index.ts:1:1)
    at FetchTransport.send (transport.ts:32:1)
    at instantSend (initialize.ts:130:1)
    at Object.execute (initialize.ts:160:1)
    at Object.pushEvent (initialize.ts:51:1)
    at SessionInstrumentation.sendSessionStartEvent (instrumentation.ts:19:1)
    at SessionInstrumentation.initialize (instrumentation.ts:24:1)
    at initialize.ts:47:1
    at Array.forEach (<anonymous>)
    at Object.add (initialize.ts:25:1)
    at registerInitialInstrumentations (registerInitial.ts:4:1)
    at initializeFaro (initialize.ts:35:1)
    at initializeFaro (initialize.ts:14:1)
    at faroConfig (useFaroInit.ts:18:1)
    at main.chunk.js:55453:3
    at observer.ts:104:1
    at useObserver.ts:126:1
    at trackDerivedFunction (derivation.ts:177:1)
    at Reaction.track (reaction.ts:137:1)
    at useObserver (useObserver.ts:124:1)
    at observerComponent (observer.ts:104:1)
    at renderWithHooks (react-dom.development.js:14985:1)
    at updateFunctionComponent (react-dom.development.js:17356:1)
    at updateSimpleMemoComponent (react-dom.development.js:17215:1)
    at beginWork (react-dom.development.js:19140:1)
    at beginWork$1 (react-dom.development.js:23940:1)
    at performUnitOfWork (react-dom.development.js:22776:1)
    at workLoopSync (react-dom.development.js:22707:1)
    at renderRootSync (react-dom.development.js:22670:1)
    at performSyncWorkOnRoot (react-dom.development.js:22293:1)
    at react-dom.development.js:11327:1
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11322:1)
    at workLoop (scheduler.development.js:417:1)
    at flushWork (scheduler.development.js:390:1)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:157:1)

Did you follow any online instructions? If so, what is the URL?

Yes. Send custom errors | Grafana Cloud documentation

Hi @marianode,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

We would appreciate it if you can open a bug report about this in our official GitHub repository using this link.

Provide all the information (you can simply copy/paste your data + screenshot from here to there).

Lastly, paste the link to your GitHub issue here in this post so that all other community users can also track it. I will also add more additional information to it :+1: