tradingview / charting-library-examples

Examples of Charting Library integrations with other libraries, frameworks and data transports
MIT License
1.33k stars 744 forks source link

REACT TypeError: this._innerWindow(...).widgetReady is not a function #265

Closed Viktor19931 closed 2 years ago

Viktor19931 commented 2 years ago

got this error on prod build

charting_library.js:1 Uncaught (in promise) TypeError: this._innerWindow(...).widgetReady is not a function

any idea why its happen ?

appreciate for any help or suggestions!

azivkovi commented 2 years ago

What turned out to be the issue?

RanjeetAtStackera commented 2 years ago

have same issue with nextjs in prod, can you please help? did you solved the issue?

Viktor19931 commented 2 years ago

Yes, the problem was that’s all routes should not redirect to index file

RanjeetAtStackera commented 2 years ago

any suggestions how can i solve this issue. i have used nextjs.

marcinrabiej commented 2 years ago

I am sorry, I didn't quite catch the resolution - can you please elaborate a bit more on this? How should the routes be set up so that this error doesn't show up?

RanjeetAtStackera commented 2 years ago

i am using the nextjs and have same issue on production server only and it works fine on local build as well as on dev, i dont have solution yet.

azivkovi commented 2 years ago

I have the same problem in Next.js production version. As far as I can tell, the library works normal even with the error, though.

RanjeetAtStackera commented 2 years ago

yes but onChartReady () fun is not working? i need that.

dilnara commented 2 years ago

The same issue. I'm trying to create electron app from existing web app. Web app with trading view iframe works, but inside electron it doesn't. Exactly the same error - this._innerWindow(...).widgetReady is not a function.

RanjeetAtStackera commented 2 years ago

My issued is solved the problem was we were deployed the site on subdomain when we switched to main domain it worked fine. check the import path and library url in widget config and also the datafeed script is imported before the page in interactive.

Viktor19931 commented 2 years ago

This issue occur because import path for trading view is incorrect

the-wrong-guy commented 1 year ago

This seems to occur with windows machines mainly, I have solved the issue by changing the library path from libraryPath: '/charting_library/', to libraryPath: 'src/charting_library',

   public static defaultProps: Omit<ChartContainerProps, 'container'> = {
      symbol: 'AAPL',
      interval: 'D' as ResolutionString,
      datafeedUrl: 'https://demo_feed.tradingview.com',
      libraryPath: 'src/charting_library',
      chartsStorageUrl: 'https://saveload.tradingview.com',
      chartsStorageApiVersion: '1.1',
      clientId: 'tradingview.com',
      userId: 'public_user_id',
      fullscreen: false,
      autosize: true,
      studiesOverrides: {},
   };
Nicol0rd commented 1 year ago

Where can get the copy for the charting_library folder?

0xAskar commented 1 year ago

I'm having the same issue, in nextjs, however, I give the correct path. Any ideas?

image
window.tvWidget = new TradingView.widget({
        symbol: "Bitfinex:BTC/USD", // default symbol
        interval: "1D", // default interval
        fullscreen: true, // displays the chart in the fullscreen mode
        container: "tv_chart_container",
        datafeed: Datafeed,
        library_path: "public/charting_library_clonned_data",
        });
sonnh58 commented 1 year ago

Hi, are you all using Cloudflare ?, Please turn off Rocket Loader™ to fix this issue.

Maximillion195 commented 1 year ago

I also had this issue. It was the locale param breaking the path to the html file. In my case the locale was being capitalised (taken from the url path) and the file did not exist. Could probably do with an error if the locale isn't valid.

xunzhimeng commented 1 year ago

Set libraryPath: 'charting_library/' works for me.

sonnx-oraichain commented 1 year ago

Hi, are you all using Cloudflare ?, Please turn off Rocket Loader™ to fix this issue.

It worked for me!, thanks