ampproject / ampproject/amphtml

[3P] Error: TypeError: undefined is not a function

Open
#23,833 4 comments 0 reactions 0 assignees View on GitHub
P3: When Possible Stale Type: Bug WG: runtime
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## What's the issue?
We're getting a typeError inside of https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/utils/rate-limit.js that's overwhelming our Sentry.io report.

undefined is not a function (evaluating 'a.setTimeout(e,c)')

Here's the code that's blowing up: ```
function fire(args) {
nextCallArgs = null;
// Lock the fire for minInterval milliseconds
locker = win.setTimeout(waiter, minInterval);
callback.apply(null, args);
}```

Here's the stack trace:

https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/utils/rate-limit.js in fire at line 37:14
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/exponential-backoff.js at line 37:3
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/inabox/inabox-viewport.js in mo at line 228:7
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/inabox/inabox-viewport.js in getTargetRect at line 209:9
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/ads/inabox/position-observer.js at line 100:21
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/observable.js in fire at line 81:7
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/ads/inabox/position-observer.js at line 69:9
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/src/utils/rate-limit.js in fire at line 39:5
https://raw.githubusercontent.com/ampproject/amphtml/1907231757120/ads/inabox/position-observer.js in d at line 44:20
/vendors~app.dc245b37b76d93276af6.js in r at line 231:11581

## How do we reproduce the issue?
I'm not exactly sure...we're just getting hammered with the errors on our error reporting service.

## What browsers are affected?

It appears to be only Safari 6.2.8, and Mac OS X 10.8.5

## Which AMP version is affected?
I'm not sure because I don't know how to reproduce.

Contributor guide

Open the contributing guide

Research direction

Start with src/utils/rate-limit.js, especially fire, and trace the call path through src/exponential-backoff.js, src/inabox/inabox-viewport.js, and ads/inabox/position-observer.js. Try to reproduce the timer failure in Safari 6.2.8 on Mac OS X 10.8.5; done means identifying the cause and verifying the behavior no longer produces the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.