Skip to content

Astro could not resolve X #9777

@muuvmuuv

Description

@muuvmuuv

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/astro

SDK Version

7.85.0

Framework Version

4.0.3

Link to Sentry event

No response

SDK Setup

import cloudflare from "@astrojs/cloudflare"
import svelte from "@astrojs/svelte"
import tailwind from "@astrojs/tailwind"
import { defineConfig } from "astro/config"
import mkcert from "vite-plugin-mkcert"
import icons from "unplugin-icons/vite"
import sentry from "@sentry/astro"
import mdx from "@astrojs/mdx"
import spotlightjs from "@spotlightjs/astro"
import { loadEnv } from "vite"

import { version, name } from "./package.json" assert { type: "json" }
const { SENTRY_AUTH_TOKEN } = loadEnv(process.env.NODE_ENV, process.cwd(), "")

// https://astro.build/config
export default defineConfig({
	site: "XXXXXXX",
	integrations: [
		svelte(),
		tailwind(),
		mdx({
			optimize: true,
		}),
		sentry({
			dsn: "XXXXXXX",
			environment: process.env.NODE_ENV,
			release: `${name}@${version}`,
			sourceMapsUploadOptions: {
				project: "website",
				authToken: SENTRY_AUTH_TOKEN,
			},
		}),
		spotlightjs(),
	],
	markdown: {
		syntaxHighlight: "prism",
	},
	i18n: {
		defaultLocale: "de",
		locales: ["de", "es"],
	},
	experimental: {
		contentCollectionCache: true,
	},
	output: "server",
	adapter: cloudflare(),
	vite: {
		server: {
			https: true,
		},
		plugins: [
			mkcert(),
			icons({
				scale: 1.2,
				compiler: "svelte",
				autoInstall: true,
			}),
			icons({
				scale: 1.2,
				compiler: "astro",
				autoInstall: true,
			}),
		],
	},
})

Steps to Reproduce

  1. Create new Astro Sentry setup with pnpm create
  2. Setup sentry
  3. Do a build

Expected Result

No build errors.

Actual Result

✘ [ERROR] Could not resolve "util"

    node_modules/.pnpm/@[email protected]/node_modules/@sentry/node/esm/integrations/context.js:6:26:
      6 │ import { promisify } from 'util';
        ╵                           ~~~~~~

  The package "util" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

Could not resolve "child_process"

Metadata

Metadata

Assignees

Labels

Package: astroIssues related to the Sentry Astro SDK

Type

No type

Projects

Status

No status

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions