Comments (5)
I have been using the intercept service to intercept segmentio messages.
We have now upgraded to their new https://github.com/segmentio/analytics-next library.
Ever since, we are not able to see any of their messages in getRequests().
I know the interceptor is set up right because it is showing all the other network calls.
Only the messages generated by the segmentio library do not show up.
Anything about this library https://github.com/segmentio/analytics-next that needs special handling for the interceptor?
Based on your description, yes. I don't know anything about that library or how it implements its tracking functionality. If you would like this service to support intercepting those requests, you will need to do some research to figure out what that library is doing differently, and why that difference doesn't play with how this library works (which is by wrapping the global window
object's fetch and XHR). Whoever in your org upgraded the library version should have determined what the changes were; so asking them would be a good place to start.
A PR to add support for whatever that library is now doing would be welcomed.
from wdio-intercept-service.
Thanks, @tehhowch, for the very quick response.
I can try creating the PR and testing it out.
Below is some code I see in the library
import unfetch from 'unfetch'
let fetch = unfetch
if (typeof window !== 'undefined') {
fetch = window.fetch || unfetch
}
export type Dispatcher = (url: string, body: object) => Promise
export default function (): { dispatch: Dispatcher } {
function dispatch(url: string, body: object): Promise {
return fetch(url, {
headers: { 'Content-Type': 'text/plain' },
method: 'post',
body: JSON.stringify(body),
})
}
return {
dispatch,
}
}
Anything stand out?
I see these additional fetch modules in the library code - unfetch, node-fetch, cross-fetch, minipass-fetch and make-fetch-happen.
from wdio-intercept-service.
@tehhowch I see the problem in the code above.
'fetch' variable is getting set at module initialization and even though the correct window.fetch (with interceptor) is passed to the analytics.page call later, dispatch is not using the current window.fetch, but uses the stored value of 'fetch'. One fix would be to make the assignment to 'fetch' inside the dispatch function. Then it would use the latest value.
from wdio-intercept-service.
There is no change possible in wdio-intercept-service, short of an entire change in its architecture (to support intercepting by some means that is not redefining window.fetch
and global XMLHttpRequest
), that will allow intercepting that code. You would need to propose the library revert a change it likely made for a specific reason, which is probably unlikely to be accepted.
from wdio-intercept-service.
@tehhowch I have created a PR for the library to enable the intercept.
from wdio-intercept-service.
Related Issues (20)
- How to stop intercepting / Setting the value of '__webdriverajax' exceeded the quota HOT 6
- Transition package from CJS to ESM HOT 3
- After updating to 4.3.0, attempting to get the network response when a filter is applied results in an error "Cannot read property trim of undefined" HOT 10
- (Version 4.2.2) Occasionally getting a java heap space error when running the network intercept too often HOT 1
- [Version 4.2.2] browser.disableInterceptor() is not a function HOT 1
- browser.getRequests() hanging without @wdio/sync module HOT 15
- Best practices with the wdio intercept service HOT 2
- Interceptor results are inconsistent
- Is there a way to abort the request? HOT 4
- Exception in .getRequests HOT 3
- Getting pending requests too HOT 1
- Not able to capture some api's called on Submit action HOT 4
- Cannot read property 'addCommand' of undefined HOT 11
- No request(empty array) returned from intercept service HOT 10
- Does getRequests() capture all the 'GET' calls in the network log? HOT 2
- can we have support async/await for wdio-intercept-service HOT 7
- wdio-intercept-service is not capturing requests invoked in iframe HOT 6
- Cypress does not intercept graphql query HOT 2
- Other request types not being collected HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wdio-intercept-service.