Puppeteer adapter + Rest persister does not work.
See original GitHub issueThe problem is that global.XMLHttpRequest
which rest persister uses is not defined. I have tried adding xhr
adapter, jus to see if it will make a difference, but I got [Polly] [adapter:xhr] XHR global not found
because I use puppeteer
options
{
adapters: ['puppeteer'],
persister: 'rest',
adapterOptions: {
puppeteer: { page },
},
persisterOptions: {
rest: {
host: 'http://localhost:8080',
},
},
}
error
TypeError: NativeXMLHttpRequest is not a constructor
at _Promise (node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:1289:17)
at new F (node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:210:28)
at ajax (node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:1288:10)
at RestPersister.ajax (node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:1345:12)
at node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:1352:36
at step (node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:1227:30)
at node_modules/@pollyjs/persister-rest/dist/cjs/pollyjs-persister-rest.js:1245:14
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
@pollyjs/persister-rest v6.0.5 Bundlephobia
Size of @pollyjs/persister-rest v6.0.5 is 142.1 kB (minified), and 43.3 kB when compressed using GZIP. Bundlephobia helps you find the performance impact of ......
Read more >pollyjs__core JavaScript and Node.js code examples - Tabnine
describe('Unit | Puppeteer Adapter', function() { setupPolly(); ... Can be overridden at runtime in cases where the * Polly server is externally hosted....
Read more >@pollyjs/adapter-puppeteer - npm
Start using @pollyjs/adapter-puppeteer in your project by running `npm i @pollyjs/adapter-puppeteer`. There are 3 other projects in the npm ...
Read more >How to use the @pollyjs/core.Polly function in @pollyjs/core | Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >https://raw.githubusercontent.com/Netflix/pollyjs/...
... (2021-12-07) ### Bug Fixes * **core:** Fix types for registering adapters and persisters ([#435](https://github.com/netflix/pollyjs/issues/435)) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@harunurhan the REST Persister is meant to be used from within a browser. Since you’re running Puppeteer in Node, I would suggest using the FS Persister instead.
@harunurhan can you bump all your @pollyjs packages to their latest versions? That should resolve the issue you’re running into.