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

TypeError: ldJson["@type"]?.toLowerCase is not a function #412

Open
mirsella opened this issue Nov 5, 2024 · 0 comments
Open

TypeError: ldJson["@type"]?.toLowerCase is not a function #412

mirsella opened this issue Nov 5, 2024 · 0 comments

Comments

@mirsella
Copy link

mirsella commented Nov 5, 2024

hey :)
got this error on the bun version, with this url https://www.lalibre.be/belgique/politique-belge/2024/11/04/puisque-larizona-est-en-etat-de-mort-clinique-vive-la-suedoise-HYG6W5EJ5FF6FPVGSBF557L37Y/

54 | export default (document, entry) => {
55 |   const ldSchemas = document.querySelectorAll('script[type="application/ld+json"]')
56 | 
57 |   ldSchemas.forEach(ldSchema => {
58 |     const ldJson = parseJson(ldSchema.textContent.replace(/[\n\r\t]/g, ''))
59 |     const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type']?.toLowerCase())
                                                                           ^
TypeError: ldJson["@type"]?.toLowerCase is not a function. (In 'ldJson["@type"]?.toLowerCase()', 'ldJson["@type"]?.toLowerCase' is undefined)
      at /app/node_modules/@extractus/article-extractor/src/utils/extractLdSchema.js:59:71
      at forEach (1:11)
      at starDefault (/app/node_modules/@extractus/article-extractor/src/utils/extractLdSchema.js:57:13)
      at starDefault (/app/node_modules/@extractus/article-extractor/src/utils/extractMetaData.js:146:19)
      at /app/node_modules/@extractus/article-extractor/src/utils/parseFromHtml.js:34:16
      at starDefault (/app/node_modules/@extractus/article-extractor/src/utils/parseFromHtml.js:32:23)
      at extractFromHtml (/app/node_modules/@extractus/article-extractor/src/main.js:31:39)
      at /app/index.ts:39:24
ndaidong added a commit that referenced this issue Nov 9, 2024
- Fix issue #412
- Update dependencies
@ndaidong ndaidong mentioned this issue Nov 9, 2024
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