google-indexing-script icon indicating copy to clipboard operation
google-indexing-script copied to clipboard

i always get this error fetch is not defined when submit the domain

Open KressIsMee opened this issue 1 year ago β€’ 15 comments

npm run index domain.com

[email protected] index ts-node ./src/cli.ts domain.com

πŸ”Ž Processing site: sc-domain:domain.com /seo/google-indexing-script/src/shared/utils.ts:19 const response = await fetch(url, options); ^ ReferenceError: fetch is not defined at fetchRetry (/seo/google-indexing-script/src/shared/utils.ts:19:22) at fetchRetry (seo/google-indexing-script/src/shared/utils.ts:29:12) at fetchRetry (/seo/google-indexing-script/src/shared/utils.ts:29:12) at fetchRetry (/seo/google-indexing-script/src/shared/utils.ts:29:12) at fetchRetry (/seo/google-indexing-script/src/shared/utils.ts:29:12) at fetchRetry (/seo/google-indexing-script/src/shared/utils.ts:29:12) at getSitemapsList (/seo/google-indexing-script/src/shared/sitemap.ts:8:36) at getSitemapPages (/seo/google-indexing-script/src/shared/sitemap.ts:38:26) at index (/seo/google-indexing-script/src/index.ts:50:50) at processTicksAndRejections (node:internal/process/task_queues:96:5)

KressIsMee avatar Mar 11 '24 01:03 KressIsMee

Your node is probably outdated, try updating that first.

@AntoineKM maybe we could check for presence of β€œfetch” and then exit early

goenning avatar Mar 11 '24 05:03 goenning

Hey, it's because you are using a version of Node prior to 18.

See: https://stackoverflow.com/a/48433898/12379218

antoinekm avatar Mar 11 '24 08:03 antoinekm

Your node is probably outdated, try updating that first.

@AntoineKM maybe we could check for presence of β€œfetch” and then exit early

We could implement node-fetch

antoinekm avatar Mar 11 '24 10:03 antoinekm

thanks by upgrading node problem solved but i got another error


(node:172055) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) πŸ”Ž Processing site: sc-domain:mywebsite.com πŸ” This service account doesn't have access to this site. ❌ No sitemaps found, add them to Google Search Console and try again. and im sure the service account json file in the right place

KressIsMee avatar Mar 11 '24 15:03 KressIsMee

Nice ! Did you miss this step ?

image

antoinekm avatar Mar 11 '24 15:03 antoinekm

Untitleffdfd

Untitled nop i didn't

KressIsMee avatar Mar 12 '24 13:03 KressIsMee

Are you sure you're on the right property? npm run index domain.com or npm run index https://domain.com are different properties, you might try both of them

antoinekm avatar Mar 12 '24 15:03 antoinekm

Are you sure you're on the right property? npm run index domain.com or npm run index https://domain.com are different properties, you might try both of them

i tryed all how can i prove that onn the right probarty i tryed all not working

KressIsMee avatar Mar 13 '24 10:03 KressIsMee

I'm so frustrated i have only one website and only now google console account

KressIsMee avatar Mar 13 '24 10:03 KressIsMee

We'll get there, don't worry, I also remember having trouble setting up the project, this will help me remember what it was and put together clearer information in the README.

Did you activate these apis:

  • https://console.cloud.google.com/apis/api/searchconsole.googleapis.com
  • https://console.cloud.google.com/apis/api/indexing.googleapis.com

antoinekm avatar Mar 14 '24 08:03 antoinekm

thanks a lot it works perfect i think i just i forget and enabled it on other project , can i access it through web, that can have multiple services account , cause i exceeded the limits of one services account and when i changed it repeats the same urls till it exceeded the limits on the same urls and control it locally, thanks a lot node --trace-deprecation ... to show where the warning was created) πŸ”Ž Processing site: https://www.domain.com/ πŸ‘‰ Found 4735 URLs in 1 sitemap πŸ“¦ Batch 1 of 95 complete πŸ“¦ Batch 2 of 95 complete πŸ“¦ Batch 3 of 95 complete πŸ“¦ Batch 4 of 95 complete πŸ“„ Processing url: https://www.dmain/prepare for power cuts and travel disruptions as storm isha hits the uk πŸ•› Indexing already requested previously. It may take a few days for Google to process it.

πŸ“„ Processing url: https://www.dmain/arsenal edges past spirited everton in close encounter πŸ•› Indexing already requested previously. It may take a few days for Google to process it.

πŸ“„ Processing url: https://www.dmain/murderonthedancefloor: the latest viral trend on tiktok πŸ•› Indexing already requested previously. It may take a few days for Google to process it.

πŸ“„ Processing url: https://www.dmain/night swim: a lukewarm attempt at horror by blumhouse productions πŸ•› Indexing already requested previously. It may take a few days for Google to process it.

πŸ“„ Processing url: https://www.dmain/breakingnews: silt police investigate incident involving u.s. rep. lauren boebert and ex-husband πŸ•› Indexing already requested previously. It may take a few days for Google to process it.

πŸ“„ Processing url: https://www.dmain/green bay packers secure nfc wild card playoff spot with victory over chicago bears πŸ•› Indexing already requested previously. It may take a few days for Google to process it.

KressIsMee avatar Mar 14 '24 09:03 KressIsMee

I've seen guys use this technique on another software, I don't know if it's authorized by Google, but if it works, you can try opening a pull request with the possibility of having several service accounts.

antoinekm avatar Mar 14 '24 10:03 antoinekm

is there any genuine web control panel for this script ? that would be awesome to change these setting even manually but through web

KressIsMee avatar Mar 14 '24 10:03 KressIsMee

Not at the moment, but it was one of my ideas 😁

antoinekm avatar Mar 15 '24 08:03 antoinekm

Not at the moment, but it was one of my ideas 😁

Its great and I like it I just facing this problem Indexing already requested previously and I can't index the new articles cause its always catch the old links according to sitemap.xml arrangement so I never got the chance to index the new lines πŸ˜’

KressIsMee avatar Mar 15 '24 12:03 KressIsMee