Is SentryLink 2.0 becomes a terminating link?
rmlevangelio opened this issue · 7 comments
Hi awesome devs,
Thanks for the great dependency. I just want to ask if SentryLink 2.0 and above becomes a terminating link like HTTP link?
Because I tried implementing it to my app and it doesn't trigger any api requests after adding sentry link before http link.
I hope you can help me with this.
Cheers,
Rem
Could you perhaps provide some code? As is explained in the readme, the following should work:
import { SentryLink } from 'apollo-link-sentry';
const client = new ApolloClient({
link: ApolloLink.from([
new SentryLink(/* See options */),
new HttpLink({ uri: 'http://localhost:4000' }),
]),
cache: new InMemoryCache(),
});
I have same implementation. I just importing all links from different files:
import { from, ApolloClient, InMemoryCache } from '@apollo/client';
import { contextLink, errorLink, httpLink, sentryLink } from './middlewares';
let apolloClient = null;
const memoryCache = new InMemoryCache();
export const createApolloClient = history => {
apolloClient = new ApolloClient({
link: from([contextLink, errorLink(history), sentryLink, httpLink]),
cache: memoryCache,
});
return apolloClient;
};
export const getApolloClient = () => apolloClient;
Middlewares.ts
export * from './http';
export * from './error';
export * from './context';
export * from './sentry';
and my sentryLink file is this:
import { SentryLink } from 'apollo-link-sentry';
export const sentryLink = new SentryLink({
breadcrumb: {
enable: true,
includeQuery: true,
includeError: true,
},
});
If I put sentryLink
AFTER httpLink
, there will be no events triggered since httpLink
is a terminating link. But right now, if I add it before, my application is not triggering graphql api requests when network error is thrown.
Which version of the apollo packages are you using, and which version of this package?
@DiederikvandenB I'm using "@apollo/client": "^3.2.9",
and "apollo-link-sentry": "^2.0.1",
Strange, from my tests everything seems to work. It seems like an environmental issue.
This only happens when deployed to CI/CD. I'll investigate further then
Let me know if it's anything related to the package, in which case I will reopen the issue. Good luck with your debugging efforts.