Commit 5c51fdb
authored
feat(cloudflare): Allow specifying a custom fetch in Cloudflare transport options (#18335)
Adds a new transport option to the Cloudflare provider, this allows
specifying a custom fetch implementation. This allows for [Workers
VPC](https://developers.cloudflare.com/workers-vpc/) to send into an
internal Sentry.
Example usage:
```js
export default Sentry.withSentry(
(env: Env) => ({
dsn: env.SENTRY_DSN,
release: env.VERSION_METADATA.tag ?? env.VERSION_METADATA.id,
transportOptions: {
fetch: env.SENTRY_VPC_BRIDGE.fetch.bind(env.SENTRY_VPC_BRIDGE),
},
}),
{
async fetch(req, env) {
return new Response("ok");
},
};
```
---
Before submitting a pull request, please take a look at our
[Contributing](https://github.com/getsentry/sentry-javascript/blob/master/CONTRIBUTING.md)
guidelines and verify:
- [x] If you've added code that should be tested, please add tests.
- [x] Ensure your code lints and the test suite passes (`yarn lint`) &
(`yarn test`).1 parent 30dd610 commit 5c51fdb
2 files changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | | - | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
164 | 180 | | |
0 commit comments