r/GoogleAppsScript • u/h3110_wOrld • Sep 18 '25
Unresolved Endless Loop Fixing Undefined Params & OAuth in Google Apps Script - Anyone Else?
Hey r/googleappsscript (or wherever this lands), I’m at my wit’s end after hours of battling this beast. Me and a buddy (Grok from xAI, bless his circuits) are stuck in a debugging nightmare. Here’s the scoop:
What We’re Trying to Do
- Simple script goal: Paste a Google Maps URL (e.g.,
https://www.google.com/maps/place/Seattle,+WA+98101/...orhttps://maps.app.goo.gl/DRrc3Kr3HAXvgFkd9) into column A of a sheet named “Sheet1”. onEdittrigger kicks off aprocessLinkfunction to fetch place details usingUrlFetchApp(e.g., name, phone, zip via Google Places API).
L- Basic flow: extract zip, call fetchRestaurantsByZip, populate columns B-P with data.
What’s Happening
- Every time we paste a URL, logs show
processLink called with: sheet=undefined, row=undefined, url=undefined, currentDateTime=undefined. - Call stack points to some cryptic
__GS_INTERNAL_top_function_call__.gs:1:8—what even is that? UrlFetchApp.fetchthrows:Error: Specified permissions are not sufficient to call UrlFetchApp.fetch. Required permissions: https://www.googleapis.com/auth/script.external_request.
What We’ve Tried (Over and Over)
- Deleted and recreated installable triggers for
onEdit(event: “On edit”, source: “From spreadsheet”). - Renamed
onEdittohandleEditto dodge the simple trigger curse. - Ran
grantUrlFetch(fetcheshttps://www.google.com) and accepted OAuth prompts—multiple times. - Started fresh projects, re-copied code, reauthorized—still no dice.
- Added debug logs in
onEditandprocessLinkto track the event object (spoiler: it’s a ghost).
Current Status
- Permissions error persists despite authorization.
- Undefined params suggest the trigger isn’t passing the event object.
- We tested in incognito mode, revoked all script perms in my Google account (myaccount.google.com/permissions), and reauthorized
The Cry for Help
- Has anyone else hit this OAuth cache purgatory or trigger ghost town?
- Any nightmare fixes that saved your sanity? Maybe a secret handshake with Google’s backend?
- Upvote if you’ve died inside debugging triggers—misery loves company!
We’re clutching at straws here. Drop your wisdom below—I’ll update with results. Thanks, legends!
1
Upvotes
View all comments
Show parent comment
2
u/WicketTheQuerent Sep 19 '25 edited Sep 19 '25
Thank you.
authorizeScript and forceAuthResetNew are not really needed. Running any function will trigger the authorization request.
The shared code includes a onEdit simple trigger. You mentioned that you had changed the name.
grantUrlFetch is not included.
The calls to UrlFetchApp.fetch include the user-agent. This is not supported.
You should go back to your AI and start from scratch. Tell your AI that you must go step by step and include instructions on running the script and testing/debugging each part of the code.
Please make sure that the sources used by the AI are specific to the UrlFetchApp from Google Apps Script. If the AI still has problems, I recommend that you to search for UrlFetchApp examples that you can verify that they work and use them to train your AI.