Repository navigation
fix(logger): use console API in JSON logger for cross-runtime compatibility - #17332
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 959a2de The changes in this PR will be included in the next version bump. This PR includes changesets to release 396 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Member
|
@matthewp this genuinely appears to be a flake. Can you rebase main? If it fails again, I’ll peel the onion. |
ematipico
approved these changes
Jul 15, 2026
Merged
dadezzz
pushed a commit
to dadezzz/university_notes
that referenced
this pull request
Jul 25, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`7.0.9` → `7.1.1`](https://renovatebot.com/diffs/npm/astro/7.0.9/7.1.1) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v7.1.1`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#711) [Compare Source](https://github.com/withastro/astro/compare/[email protected]@7.1.1) ##### Patch Changes - [#​17399](withastro/astro#17399) [`4b03702`](withastro/astro@4b03702) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes encoded request paths being routed incorrectly when using domain-based i18n ### [`v7.1.0`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#710) [Compare Source](https://github.com/withastro/astro/compare/[email protected]@7.1.0) ##### Minor Changes - [#​17302](withastro/astro#17302) [`5f4dc03`](withastro/astro@5f4dc03) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Adds a new `deferRender` option to the `glob()` content loader When set to `true`, renderable entries (such as Markdown) are not rendered during content sync. Instead, rendering is deferred until the entry is actually rendered in a page, using the same on-demand path that `.mdx` files already use. This reduces memory usage during `astro build` for large collections whose rendered output is much larger than the source — for example, Markdown that uses heavy rehype plugins like `rehype-katex`. Such builds could previously run out of memory while storing the eagerly-rendered HTML for every entry. ```js // src/content.config.ts import { defineCollection } from 'astro:content'; import { glob } from 'astro/loaders'; const docs = defineCollection({ loader: glob({ pattern: '**/*.md', base: 'src/content/docs', deferRender: true }), }); ``` By default `deferRender` is `false`, preserving the existing behavior of rendering entries eagerly during sync so their rendered HTML can be cached across builds. - [#​17296](withastro/astro#17296) [`30698a2`](withastro/astro@30698a2) Thanks [@​ematipico](https://github.com/ematipico)! - Adds a new experimental `collectionStorage` option for controlling how the content layer persists its data store By default, Astro serializes the entire content layer data store to a single file (`.astro/data-store.json`). For very large content collections, this file can grow large enough to hit platform file-size limits. Set `experimental.collectionStorage: 'chunked'` to instead split the data store across many smaller, content-addressed files inside a `.astro/data-store/` directory, described by a manifest: ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ experimental: { collectionStorage: 'chunked', }, }); ``` Because each part file is named by a hash of its contents, unchanged parts keep the same name across builds and are not rewritten, and identical parts are deduplicated. The default value is `'single-file'`, which preserves the current behavior. - [#​17214](withastro/astro#17214) [`44c4989`](withastro/astro@44c4989) Thanks [@​ematipico](https://github.com/ematipico)! - Adds support for the more specific CSP directives `script-src-elem`, `script-src-attr`, `style-src-elem`, and `style-src-attr` through a new `kind` option. Previously, [`CSP`](https://docs.astro.build/en/reference/configuration-reference/#securitycsp) was only scoped to generic `script-src`/`style-src` directives. Now each source or hash can be scoped to a narrower directive — for example, to allow inline `style` attributes (such as those from `define:vars` or Shiki) without loosening the policy for your `<style>` and `<link>` elements. ##### Scoping sources and hashes in your config Each entry in `resources` and `hashes` can be an object with a `kind` property. Depending on whether you use `scriptDirective` or `styleDirective`, `"element"` targets `script-src-elem` or `style-src-elem`, `"attribute"` targets `script-src-attr` or `style-src-attr`, and `"default"` (the same as a bare string or hash) targets `script-src` or `style-src`. ```js // astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ security: { csp: { scriptDirective: { resources: [{ resource: 'https://cdn.example.com', kind: 'element' }], }, styleDirective: { resources: [{ resource: "'unsafe-inline'", kind: 'attribute' }], }, }, }, }); ``` ##### Scoping at runtime The same `kind` option is available on the runtime CSP API, where the existing methods now also accept an object: ```js ctx.csp.insertScriptResource({ resource: 'https://cdn.example.com', kind: 'element' }); ctx.csp.insertStyleResource({ resource: "'unsafe-inline'", kind: 'attribute' }); ``` - [#​17258](withastro/astro#17258) [`84814d4`](withastro/astro@84814d4) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Adds a new `format()` option to the [`paginate`](https://docs.astro.build/en/reference/routing-reference/#paginate) utility. The `format()` option is a function that accepts the current URL of the page, and returns a new URL. For example, when your host only supports URLs using the `.html` extension, you can use `format()` to add it to the generated URLs: ```astro --- export async function getStaticPaths({ paginate }) { // Load your data with fetch(), getCollection(), etc. const response = await fetch(`https://pokeapi.co/api/v2/pokemon?limit=150`); const result = await response.json(); const allPokemon = result.results; // Return a paginated collection of paths for all items return paginate(allPokemon, { pageSize: 10, format: (url) => `${url}.html`, }); } const { page } = Astro.props; --- ``` - [#​17331](withastro/astro#17331) [`7db6420`](withastro/astro@7db6420) Thanks [@​matthewp](https://github.com/matthewp)! - Adds a `--ignore-lock` flag to `astro dev` for starting a dev server without checking or writing the lock file, so it can run alongside an already-running dev server for the same project. The new instance is not tracked by `astro dev stop`, `astro dev status`, or `astro dev logs`. `--ignore-lock` cannot be combined with `--background` (or an auto-detected AI agent environment, which runs dev servers in the background automatically) or `--force`, since those rely on the lock file. ```shell astro dev --ignore-lock ``` - [#​17389](withastro/astro#17389) [`16de021`](withastro/astro@16de021) Thanks [@​florian-lefebvre](https://github.com/florian-lefebvre)! - Allows passing URL entrypoints when configuring the logger Matching other APIs like session drivers or font providers, the logger entrypoint can now be a URL: ```js import { defineConfig } from 'astro/config'; export default defineConfig({ logger: { entrypoint: new URL('./logger.js', import.meta.url), }, }); ``` ##### Patch Changes - [#​17332](withastro/astro#17332) [`4407483`](withastro/astro@4407483) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes the JSON logger crashing with `process is not defined` in non-Node runtimes like Cloudflare's workerd. The JSON logger now uses `console.log`/`console.error` instead of `process.stdout`/`process.stderr`, matching the pattern already used by the console logger. - [#​17391](withastro/astro#17391) [`186a1e7`](withastro/astro@186a1e7) Thanks [@​florian-lefebvre](https://github.com/florian-lefebvre)! - Fixes a case where an integration could not update the logger with `updateConfig()` - [#​17394](withastro/astro#17394) [`d9f99e1`](withastro/astro@d9f99e1) Thanks [@​matthewp](https://github.com/matthewp)! - Fixes element-specific CSP directives to preserve the existing behavior of configured script and style resources - [#​17374](withastro/astro#17374) [`b2d1b3e`](withastro/astro@b2d1b3e) Thanks [@​astrobot-houston](https://github.com/astrobot-houston)! - Fixes dev server returning 404 for `?url` imported assets when accessed via browser navigation - [#​17390](withastro/astro#17390) [`ed71eaf`](withastro/astro@ed71eaf) Thanks [@​florian-lefebvre](https://github.com/florian-lefebvre)! - Removes an unused and undocumented generic from the `AstroLoggerDestination` type - [#​17393](withastro/astro#17393) [`092da56`](withastro/astro@092da56) Thanks [@​matthewp](https://github.com/matthewp)! - Hardens generated transition styles, development metadata, and server island URLs when embedding dynamic values </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNjAuMiIsInVwZGF0ZWRJblZlciI6IjQzLjI3Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash where
astro dev --json(or any project using the JSON logger) would return HTTP 500 for every request when using the Cloudflare adapter.Closes #17280
Root Cause
The JSON logger's
write()method referencedprocess.stderrandprocess.stdoutdirectly. When the Cloudflare adapter handles requests inside workerd — Cloudflare's local dev runtime — theprocessglobal doesn't exist, causing aReferenceErroron every log call. The error then cascaded: the error handler tried to log via the same broken logger, swallowing the original message and returning a 500.This is especially easy to hit without explicitly passing
--json, because Astro automatically enables JSON logging when it detects it is running inside a coding agent.Fix
packages/astro/src/core/logger/impls/json.tsnow usesconsole.error/console.loginstead ofprocess.stderr.write/process.stdout.write. The console API is available in all JS runtimes including workerd. This matches the pattern already used by the sibling console logger.The node logger (
node.ts) was intentionally not changed — it only ever runs in Node.js whereprocessis guaranteed, and it relies onprocess.stdout.writeto supportnewLine: falsefor composing multi-part build output lines (e.g. filename + render timing on the same line). Changing it would break that formatting.As a side effect, the JSON logger no longer emits a partial (non-newline-terminated) write for
newLine: falseevents, which previously concatenated two JSON objects without a separator — producing unparseable output. Each event now unconditionally gets its own line, which is correct JSONL format.Changes
packages/astro/src/core/logger/impls/json.ts— replaceprocess.stdout/process.stderrwithconsole.log/console.error; remove now-unusedConsoleStreamtype andnode:streamimportpackages/astro/test/units/logger/destination.test.ts— update tests to spy onconsole.log/console.errorinstead ofprocess.stdout.write/process.stderr.write; add a cross-runtime compatibility test assertingwrite()contains noprocess.reference.changeset/cool-rice-exist.md— patch changeset forastro