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
1
u/h3110_wOrld Sep 19 '25
Thanks for the input! We took your advice and ensured the `onEdit(e)` function is leveraging the event object to derive all necessary info, like sheet, row, and URL, but we’re still seeing logs with undefined values for `processLink`. We also added the OAuth scopes to `appscript.json` as suggested, yet the `UrlFetchApp.fetch` permission error persists in B2. The V8 engine artifact in the call stack is noted and ignored as you mentioned. Despite these efforts, we’re still hitting roadblocks—any further insights would be greatly appreciated!