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

Problem with "timeRangeToNrql" #98

Open
rangakore opened this issue Nov 2, 2023 · 1 comment
Open

Problem with "timeRangeToNrql" #98

rangakore opened this issue Nov 2, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@rangakore
Copy link

Description

The Problem is "If I timeRangeToNrql functionality in my nerdlet, the UI is not getting rendering.

The below is showing in Visual Studio Code at import statement

Could not find a declaration file for module '@newrelic/nr1-community'. 'c:/SRE/test/testing/node_modules/@newrelic/nr1-community/dist/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/newrelic__nr1-community if it exists or add a new declaration (.d.ts) file containing declare module '@newrelic/nr1-community';

We are tyring to make use of "timeRangeToNrql" from "@newrelic/nr1-community" package in order to access default Datetimepicker provided by nerdpack. It was working until around 10/30/2023 10 AM EST. From chrome console we observed below error

Uncaught (in promise) ReferenceError: regeneratorRuntime is not defined
    at index.es.js:24:2303
    at index.es.js:24:3275
    at Module.<anonymous> (index.es.js:32:985)
    at ./node_modules/@newrelic/nr1-community/dist/index.es.js (vendors~feee8365-58d5-4e00-8de9-32ea9721a57f--home~latest.js:52549:30)
    at __webpack_require__ (bootstrap:82:1)
    at ./nerdlets/home/index.js (bootstrap:261:1)
    at __webpack_require__ (bootstrap:82:1)
    at Object.__factory (bootstrap:257:1)
    at z (3rd-app-fdec6153.js:1:3122530)
    at 3rd-app-fdec6153.js:1:2073654

If I comment below import

import { timeRangeToNrql } from '@newrelic/nr1-community'

then UI is getting rendered.

below is the sample code

import React from 'react';

import {
  LineChart,
  PlatformStateContext,
} from 'nr1'

import { timeRangeToNrql } from '@newrelic/nr1-community'

export default class HomeNerdlet extends React.Component {
  render() {
    let query = `from NrAiIncident SELECT count(*) where event = 'close' and tags.label.appname is not null facet dayOfMonthOf(timestamp), tags.label.appname`
  
    return (
      <>
        <PlatformStateContext.Consumer>
          {
            (PlatformState) =>  {
              const since = timeRangeToNrql(PlatformState)
              return (
                <LineChart
                  accountIds={[2327062]}
                  query={
                    query +
                    ' ' +
                    since +
                    'TIMESERIES AUTO'
                  }
                  fullWidth
                />
              )
            }
          }
        </PlatformStateContext.Consumer>
      </>
    )
  }
}

Steps to Reproduce

Expected Behaviour

Relevant Logs / Console output

Your Environment

  • NR1 CLI version used: @datanerd/nr1/2.83.5 win32-x64 node-v16.11.1
  • Browser name and version: Chrome Version 119.0.6045.105 (Official Build) (64-bit)
  • Operating System and version: Windows 11

Additional context

@rangakore rangakore added the bug Something isn't working label Nov 2, 2023
@rangakore
Copy link
Author

For now, resolved the issue by changing to import to below

import { timeRangeToNrql } from '@newrelic/nr-labs-components'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant