Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/content/docs/workers/platform/known-issues.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ You will notice that all examples trigger Worker B. This includes the final exam
When adding a wildcard on a subdomain, here are how the following URLs will be resolved:

```
// (A) *.example.com/a
// (B) a.example.com/*
// (A) *.example.com/a
// (B) a.example.com/*

"a.example.com/a"
// -> B
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/workers/reference/security-model.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ The values of `start` and `end` will always be exactly the same. The attacker ca

:::note

This measure was implemented in mid-2017, before Spectre was announced. This measure was implemented because Cloudflare was already concerned about side channel timing attacks. The Workers team has designed the system with side channels in mind.
This measure was implemented in mid-2017, before Spectre was announced. This measure was implemented because Cloudflare was already concerned about side channel timing attacks. The Workers team has designed the system with side channels in mind.
:::

Similarly, multi-threading and shared memory are not permitted in Workers. Everything related to the processing of one event happens on the same thread. Otherwise, one would be able to race threads in order to guess and check the underlying timer. Multiple Workers are not allowed to operate on the same request concurrently. For example, if you have installed a Cloudflare App on your zone which is implemented using Workers, and your zone itself also uses Workers, then a request to your zone may actually be processed by two Workers in sequence. These run in the same thread.
Expand All @@ -187,7 +187,7 @@ At this point, measuring code execution time locally is prevented. However, it c

:::note

It has been suggested that if Workers reset its execution environment on every request, that Workers would be in a much safer position against timing attacks. Unfortunately, it is not so simple. The execution state could be stored in a client — not the Worker itself — allowing a Worker to resume its previous state on every new request.
It has been suggested that if Workers reset its execution environment on every request, that Workers would be in a much safer position against timing attacks. Unfortunately, it is not so simple. The execution state could be stored in a client — not the Worker itself — allowing a Worker to resume its previous state on every new request.
:::

In adversarial testing and with help from leading Spectre experts, Cloudflare has not been able to develop a remote timing attack that works in production. However, the lack of a working attack does not mean that Workers should stop building defenses. Instead, the Workers team is currently testing some more advanced measures.
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/workers/runtime-apis/context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Context is exposed via the following places:

If you are using `waitUntil()` to emit logs or exceptions, we recommend using [Tail Workers](/workers/observability/logs/tail-workers/) instead. Even if your Worker throws an uncaught exception, the Tail Worker will execute, ensuring that you can emit logs or exceptions regardless of the Worker's invocation status.

[Cloudflare Queues](/queues/) is purpose-built for performing work out-of-band, without blocking returning a response back to the client Worker.
[Cloudflare Queues](/queues/) is purpose-built for performing work out-of-band, without blocking returning a response back to the client Worker.
:::

You can call `waitUntil()` multiple times. Similar to `Promise.allSettled`, even if a promise passed to one `waitUntil` call is rejected, promises passed to other `waitUntil()` calls will still continue to execute.
Expand Down Expand Up @@ -60,7 +60,7 @@ export default {

The Workers Runtime uses streaming for request and response bodies. It does not buffer the body. Hence, if an exception occurs after the body has been consumed, `passThroughOnException()` cannot send the body again.

If this causes issues, we recommend cloning the request body and handling exceptions in code. This will protect against uncaught code exceptions. However some exception times such as exceed CPU or memory limits will not be mitigated.
If this causes issues, we recommend cloning the request body and handling exceptions in code. This will protect against uncaught code exceptions. However some exception times such as exceed CPU or memory limits will not be mitigated.
:::

The `passThroughOnException` method allows a Worker to [fail open](https://community.microfocus.com/cyberres/b/sws-22/posts/security-fundamentals-part-1-fail-open-vs-fail-closed), and pass a request through to an origin server when a Worker throws an unhandled exception. This can be useful when using Workers as a layer in front of an existing service, allowing the service behind the Worker to handle any unexpected error cases that arise in your Worker.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/runtime-apis/handlers/tail.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default {
Outcome is equivalent to the exit status of a script and an indicator of whether it has fully run to completion. A Worker outcome may differ from a response code if, for example:

* a script successfully processes a request but is logically designed to return a `4xx`/`5xx` response.
* a script sends a successful `200` response but an asynchronous task registered via `waitUntil()` later exceeds CPU or memory limits.
* a script sends a successful `200` response but an asynchronous task registered via `waitUntil()` later exceeds CPU or memory limits.
:::

### `FetchEventInfo`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Render } from "~/components"
The [`node:string_decoder`](https://nodejs.org/api/string_decoder.html) is a legacy utility module that predates the WHATWG standard [TextEncoder](/workers/runtime-apis/encoding/#textencoder) and [TextDecoder](/workers/runtime-apis/encoding/#textdecoder) API. In most cases, you should use `TextEncoder` and `TextDecoder` instead. `StringDecoder` is available in the Workers runtime primarily for compatibility with existing npm packages that rely on it. `StringDecoder` can be accessed using:

```js
const { StringDecoder } = require('node:string_decoder');
const { StringDecoder } = require('node:string_decoder');
const decoder = new StringDecoder('utf8');

const cent = Buffer.from([0xC2, 0xA2]);
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/runtime-apis/nodejs/util.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ types.isAsyncFunction(async function foo() {}); // Returns true

:::caution

The Workers implementation currently does not provide implementations of the `util.types.isExternal()`, `util.types.isProxy()`, `util.types.isKeyObject()`, or `util.type.isWebAssemblyCompiledModule()` APIs.
The Workers implementation currently does not provide implementations of the `util.types.isExternal()`, `util.types.isProxy()`, `util.types.isKeyObject()`, or `util.type.isWebAssemblyCompiledModule()` APIs.
:::

For more about `util.types`, refer to the [Node.js documentation for `util.types`](https://nodejs.org/dist/latest-v19.x/docs/api/util.html#utiltypes).
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/runtime-apis/response.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let response = new Response(body, init);



Valid options for the `options` object include:
Valid options for the `options` object include:

* `cf` any | null
* An object that contains Cloudflare-specific information. This object is not part of the Fetch API standard and is only available in Cloudflare Workers. This field is only used by consumers of the Response for informational purposes and does not have any impact on Workers behavior.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const reader = readable.getReader();

:::caution[Warning]

Any data not yet read is lost.
Any data not yet read is lost.
:::

* `releaseLock()` : void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Refer to the [WritableStreamDefaultWriter](/workers/runtime-apis/streams/writabl

:::caution[Warning]

Any data not yet written is lost upon abort.
Any data not yet written is lost upon abort.
:::

* `getWriter()` : WritableStreamDefaultWriter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ writeArrayToStream([1, 2, 3, 4, 5], writableStream)

:::caution[Warning]

Any data not yet written is lost upon abort.
Any data not yet written is lost upon abort.
:::

* `close()` : Promise\<void>
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/runtime-apis/tcp-sockets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Many application-layer protocols are built on top of the Transmission Control Pr

:::note

Connecting to a PostgreSQL database? You should use [Hyperdrive](/hyperdrive/), which provides the `connect()` API with built-in connection pooling and query caching.
Connecting to a PostgreSQL database? You should use [Hyperdrive](/hyperdrive/), which provides the `connect()` API with built-in connection pooling and query caching.
:::

:::note
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/runtime-apis/web-crypto.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Some common uses include [signing requests](/workers/examples/signing-requests/)

:::caution

The Web Crypto API differs significantly from the [Node.js Crypto API](/workers/runtime-apis/nodejs/crypto/). If you are working with code that relies on the Node.js Crypto API, you can use it by enabling the [`nodejs_compat` compatibility flag](/workers/runtime-apis/nodejs/).
The Web Crypto API differs significantly from the [Node.js Crypto API](/workers/runtime-apis/nodejs/crypto/). If you are working with code that relies on the Node.js Crypto API, you can use it by enabling the [`nodejs_compat` compatibility flag](/workers/runtime-apis/nodejs/).
:::

***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ cd worker-turso-ts

In your project directory, you now have the following files:

- `wrangler.json` / `wrangler.toml`: [Wrangler configuration file](/workers/wrangler/configuration/)
- `wrangler.json` / `wrangler.toml`: [Wrangler configuration file](/workers/wrangler/configuration/)
- `src/index.ts`: A minimal Hello World Worker written in TypeScript
- `package.json`: A minimal Node dependencies configuration file.
- `tsconfig.json`: TypeScript configuration that includes Workers types. Only generated if indicated.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/workers/wrangler/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ A common example of using a redirected configuration is where a custom build too
binding = "<BINDING_NAME1>"
id = "<NAMESPACE_ID1>"
```

</WranglerConfig>

Note that this configuration points `main` at the user's code entry-point.
Expand Down