konhi/react-static-clutch-embed

Getting Call stack error. when i pass my company clutch widget parameters even after cloning whole code.

Opened this issue · 5 comments

Getting Call stack error. when i pass my company clutch widget parameters even after cloning whole code.

ERROR:
Server Error
TypeError: Cannot read properties of undefined (reading 'getAttribute')

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
javascript/packages/static-clutch-embed/dist/index.js (57:0) @ parseLink

55 |
56 | // src/reviews/utils/parsing-utils.ts

57 | var parseLink = (el) => el.getAttribute("href");
58 | var parseReviewText = (el) => el.textContent?.trim().slice(1, -1);
59 | var parseReviewRating = (el) => Number(el.textContent);
60 | var parseCompanyReviewsCount = (el) => Number(el.textContent?.split("reviews")[0]);
Call Stack
eval
javascript/packages/static-clutch-embed/dist/index.js (128:0)
Array.map

getReviewsData javascript/packages/static-clutch-embed/dist/index.js (127:0) process.processTicksAndRejections node:internal/process/task_queues (95:5) async getStaticProps pages/index.tsx (35:30)

hey @Hexaali,

I didn't really test this lib much, it's just something I wrote in free time for my company, although I'm happy to make it work :)
could you please set up reproducible example of your problem, e.g. create code sandbox with nextjs and this lib, to show steps for reproducing this error?

hi @konhi.

first i installed both libraries ( static-clutch-embed , react-static-clutch-embed ) in my nextjs project then i cloned this code/project in my IDE. and just replaced your company id ( uid = 33218 ) with my company id (uid = 2108125 ) in apps/web/pages/index.tsx and it gave me error:

ERROR:
Server Error
TypeError: Cannot read properties of undefined (reading 'getAttribute')

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
javascript/packages/static-clutch-embed/dist/index.js (57:0) @ parseLink

55 |
56 | // src/reviews/utils/parsing-utils.ts

57 | var parseLink = (el) => el.getAttribute("href");
58 | var parseReviewText = (el) => el.textContent?.trim().slice(1, -1);
59 | var parseReviewRating = (el) => Number(el.textContent);
60 | var parseCompanyReviewsCount = (el) => Number(el.textContent?.split("reviews")[0]);
Call Stack
eval
javascript/packages/static-clutch-embed/dist/index.js (128:0)
Array.map

getReviewsData javascript/packages/static-clutch-embed/dist/index.js (127:0) process.processTicksAndRejections node:internal/process/task_queues (95:5) async getStaticProps pages/index.tsx (35:30)

am i implementing it wrong ?

@Hexaali can you provide repo/codesandbox?

hi @konhi. i'm unable to create a repo.
as i'm a beginner can you please help me in simply how can i use this in my nextjs web project. also tell me is this premium or free to use ?

also i want you to know:

  1. that i have just download this project
  2. opened index.tsx file removed old UID WITH the Correct My company UID in Widgetparams
  3. when i " pnpm run dev " app its work fine with default UID: 33215 but not with the one i'm trying to pass as UID: 2108125.
    what should be done to make it work ?
  4. Why i'm unable to get data?