jontewks/puppeteer-heroku-buildpack

Automatically purge cache?

hems opened this issue · 1 comments

hems commented

Hello, i'm wondering if you explored or have any ideas on how we cold purge automatically?

Since i'm not very familiar with this the only way i can think of now would be to automatically trigger the purge cache from Heroku using an empty git commit as suggested on heroku:

git commit --allow-empty -m "Purge cache"
git push heroku master

But i suspect there must be an easier way than trigger an entire redeploy of the application?

Looking at this stack overflow i can see suggestions on disabling cache or using an icognito tab, that might be useful and/or related but at this stage i'm not sure if that would solve my problem and/if it's the best solution in terms of optimisation.

I can also see a suggestion in this comment of starting puppeteer with --disk-cache-size=0 parameter in order to avoid cache, i wonder if that would solve our issues on Heroku...

Any recommendations / suggestions from you would be really appreciated.

btw, here are the kind of errors that happen to me :

2023-12-06T20:18:09.532872+00:00 app[web.1]: ProtocolError: Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
2023-12-06T20:18:09.532872+00:00 app[web.1]: at <instance_members_initializer> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:96:14)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:100:16)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:32:26)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:91:26)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at CdpCDPSession.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:78:33)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at NetworkManager.addClient (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/NetworkManager.js:80:20)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at FrameManager.initialize (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/FrameManager.js:189:38)
2023-12-06T20:18:09.532872+00:00 app[web.1]: at #initialize (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:312:36)
2023-12-06T20:18:09.532873+00:00 app[web.1]: at CdpPage._create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:98:31)
2023-12-06T20:18:09.532873+00:00 app[web.1]: at /app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Target.js:199:42
2023-12-06T20:18:09.532886+00:00 app[web.1]: ProtocolError: Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.

2023-12-06T21:19:14.978485+00:00 app[web.1]: TargetCloseError: Protocol error (Page.addScriptToEvaluateOnNewDocument): Target closed
2023-12-06T21:19:14.978485+00:00 app[web.1]: at CallbackRegistry.clear (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:85:36)
2023-12-06T21:19:14.978485+00:00 app[web.1]: at CdpCDPSession._onClosed (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:113:25)
2023-12-06T21:19:14.978486+00:00 app[web.1]: at #onClose (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:168:21)
2023-12-06T21:19:14.978486+00:00 app[web.1]: at WebSocket.<anonymous> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js:57:30)
2023-12-06T21:19:14.978486+00:00 app[web.1]: at callListener (/app/node_modules/ws/lib/event-target.js:290:14)
2023-12-06T21:19:14.978486+00:00 app[web.1]: at WebSocket.onClose (/app/node_modules/ws/lib/event-target.js:220:9)
2023-12-06T21:19:14.978487+00:00 app[web.1]: at WebSocket.emit (node:events:514:28)
2023-12-06T21:19:14.978487+00:00 app[web.1]: at WebSocket.emitClose (/app/node_modules/ws/lib/websocket.js:260:10)
2023-12-06T21:19:14.978487+00:00 app[web.1]: at Socket.socketOnClose (/app/node_modules/ws/lib/websocket.js:1272:15)
2023-12-06T21:19:14.978487+00:00 app[web.1]: at Socket.emit (node:events:514:28) {
2023-12-06T21:19:14.978488+00:00 app[web.1]: cause: ProtocolError
2023-12-06T21:19:14.978488+00:00 app[web.1]: at <instance_members_initializer> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:96:14)
2023-12-06T21:19:14.978488+00:00 app[web.1]: at new Callback (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:100:16)
2023-12-06T21:19:14.978488+00:00 app[web.1]: at CallbackRegistry.create (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:32:26)
2023-12-06T21:19:14.978488+00:00 app[web.1]: at Connection._rawSend (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:91:26)
2023-12-06T21:19:14.978489+00:00 app[web.1]: at CdpCDPSession.send (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:78:33)
2023-12-06T21:19:14.978489+00:00 app[web.1]: at next (/app/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:34:41)
2023-12-06T21:19:14.978489+00:00 app[web.1]: at CdpCDPSession.send (/app/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js:67:18)
2023-12-06T21:19:14.978489+00:00 app[web.1]: at CdpPage.evaluateOnNewDocument (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:756:64)
2023-12-06T21:19:14.978489+00:00 app[web.1]: at Object.evaluateOnNewDocument (/app/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/withUtils.js:33:17)
2023-12-06T21:19:14.978489+00:00 app[web.1]: at Plugin.onPageCreated (/app/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js:27:27)
2023-12-06T21:19:14.978490+00:00 app[web.1]: }