0

Update a projects symbol source

by
Published Oct 17, 2025

Update a custom symbol source in a project.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update a projects symbol source
4
 * Update a custom symbol source in a project.
5
 */
6
export async function main(
7
	auth: RT.Sentry,
8
	project_id_or_slug: string,
9
	id: string | undefined,
10
	body: Body
11
) {
12
	const url = new URL(
13
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/symbol-sources/`
14
	)
15
	for (const [k, v] of [['id', id]]) {
16
		if (v !== undefined && v !== '') {
17
			url.searchParams.append(k, v)
18
		}
19
	}
20
	const response = await fetch(url, {
21
		method: 'PUT',
22
		headers: {
23
			'Content-Type': 'application/json',
24
			Authorization: 'Bearer ' + auth.token
25
		},
26
		body: JSON.stringify(body)
27
	})
28
	if (!response.ok) {
29
		const text = await response.text()
30
		throw new Error(`${response.status} ${text}`)
31
	}
32
	return await response.json()
33
}
34

35
/* eslint-disable */
36
/**
37
 * This file was automatically generated by json-schema-to-typescript.
38
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
39
 * and run json-schema-to-typescript to regenerate this file.
40
 */
41

42
export interface Body {
43
	/**
44
	 * The type of the source.
45
	 *
46
	 * * `http` - SymbolServer (HTTP)
47
	 * * `gcs` - Google Cloud Storage
48
	 * * `s3` - Amazon S3
49
	 */
50
	type: 'http' | 'gcs' | 's3'
51
	/**
52
	 * The human-readable name of the source.
53
	 */
54
	name: string
55
	/**
56
	 * The internal ID of the source. Must be distinct from all other source IDs and cannot start with '`sentry:`'. If this is not provided, a new UUID will be generated.
57
	 */
58
	id?: string
59
	/**
60
	 * Layout settings for the source. This is required for HTTP, GCS, and S3 sources.
61
	 *
62
	 * **`type`** ***(string)*** - The layout of the folder structure. The options are:
63
	 * - `native` - Platform-Specific (SymStore / GDB / LLVM)
64
	 * - `symstore` - Microsoft SymStore
65
	 * - `symstore_index2` - Microsoft SymStore (with index2.txt)
66
	 * - `ssqp` - Microsoft SSQP
67
	 * - `unified` - Unified Symbol Server Layout
68
	 * - `debuginfod` - debuginfod
69
	 *
70
	 * **`casing`** ***(string)*** - The layout of the folder structure. The options are:
71
	 * - `default` - Default (mixed case)
72
	 * - `uppercase` - Uppercase
73
	 * - `lowercase` - Lowercase
74
	 *
75
	 * ```json
76
	 * {
77
	 *     "layout": {
78
	 *         "type": "native"
79
	 *         "casing": "default"
80
	 *     }
81
	 * }
82
	 * ```
83
	 */
84
	layout?: {
85
		/**
86
		 * The source's layout type.
87
		 *
88
		 * * `native`
89
		 * * `symstore`
90
		 * * `symstore_index2`
91
		 * * `ssqp`
92
		 * * `unified`
93
		 * * `debuginfod`
94
		 * * `slashsymbols`
95
		 */
96
		type:
97
			| 'native'
98
			| 'symstore'
99
			| 'symstore_index2'
100
			| 'ssqp'
101
			| 'unified'
102
			| 'debuginfod'
103
			| 'slashsymbols'
104
		/**
105
		 * The source's casing rules.
106
		 *
107
		 * * `lowercase`
108
		 * * `uppercase`
109
		 * * `default`
110
		 */
111
		casing: 'lowercase' | 'uppercase' | 'default'
112
		[k: string]: unknown
113
	}
114
	/**
115
	 * Filter settings for the source. This is optional for all sources.
116
	 *
117
	 * **`filetypes`** ***(list)*** - A list of file types that can be found on this source. If this is left empty, all file types will be enabled. The options are:
118
	 * - `pe` - Windows executable files
119
	 * - `pdb` - Windows debug files
120
	 * - `portablepdb` - .NET portable debug files
121
	 * - `mach_code` - MacOS executable files
122
	 * - `mach_debug` - MacOS debug files
123
	 * - `elf_code` - ELF executable files
124
	 * - `elf_debug` - ELF debug files
125
	 * - `wasm_code` - WASM executable files
126
	 * - `wasm_debug` - WASM debug files
127
	 * - `breakpad` - Breakpad symbol files
128
	 * - `sourcebundle` - Source code bundles
129
	 * - `uuidmap` - Apple UUID mapping files
130
	 * - `bcsymbolmap` - Apple bitcode symbol maps
131
	 * - `il2cpp` - Unity IL2CPP mapping files
132
	 * - `proguard` - ProGuard mapping files
133
	 *
134
	 * **`path_patterns`** ***(list)*** - A list of glob patterns to check against the debug and code file paths of debug files. Only files that match one of these patterns will be requested from the source. If this is left empty, no path-based filtering takes place.
135
	 *
136
	 * **`requires_checksum`** ***(boolean)*** - Whether this source requires a debug checksum to be sent with each request. Defaults to `false`.
137
	 *
138
	 * ```json
139
	 * {
140
	 *     "filters": {
141
	 *         "filetypes": ["pe", "pdb", "portablepdb"],
142
	 *         "path_patterns": ["*ffmpeg*"]
143
	 *     }
144
	 * }
145
	 * ```
146
	 */
147
	filters?: {
148
		/**
149
		 * The file types enabled for the source.
150
		 */
151
		filetypes?: (
152
			| 'pe'
153
			| 'pdb'
154
			| 'portablepdb'
155
			| 'mach_debug'
156
			| 'mach_code'
157
			| 'elf_debug'
158
			| 'elf_code'
159
			| 'wasm_debug'
160
			| 'wasm_code'
161
			| 'breakpad'
162
			| 'sourcebundle'
163
			| 'uuidmap'
164
			| 'bcsymbolmap'
165
			| 'il2cpp'
166
			| 'proguard'
167
			| 'dartsymbolmap'
168
		)[]
169
		/**
170
		 * The debug and code file paths enabled for the source.
171
		 */
172
		path_patterns?: string[]
173
		/**
174
		 * Whether the source requires debug checksums.
175
		 */
176
		requires_checksum?: boolean
177
		[k: string]: unknown
178
	}
179
	/**
180
	 * The source's URL. Optional for HTTP sources, invalid for all others.
181
	 */
182
	url?: string
183
	/**
184
	 * The user name for accessing the source. Optional for HTTP sources, invalid for all others.
185
	 */
186
	username?: string
187
	/**
188
	 * The password for accessing the source. Optional for HTTP sources, invalid for all others.
189
	 */
190
	password?: string
191
	/**
192
	 * The GCS or S3 bucket where the source resides. Required for GCS and S3 source, invalid for HTTP sources.
193
	 */
194
	bucket?: string
195
	/**
196
	 * The source's [S3 region](https://docs.aws.amazon.com/general/latest/gr/s3.html). Required for S3 sources, invalid for all others.
197
	 *
198
	 * * `us-east-2` - US East (Ohio)
199
	 * * `us-east-1` - US East (N. Virginia)
200
	 * * `us-west-1` - US West (N. California)
201
	 * * `us-west-2` - US West (Oregon)
202
	 * * `ap-east-1` - Asia Pacific (Hong Kong)
203
	 * * `ap-south-1` - Asia Pacific (Mumbai)
204
	 * * `ap-northeast-2` - Asia Pacific (Seoul)
205
	 * * `ap-southeast-1` - Asia Pacific (Singapore)
206
	 * * `ap-southeast-2` - Asia Pacific (Sydney)
207
	 * * `ap-northeast-1` - Asia Pacific (Tokyo)
208
	 * * `ca-central-1` - Canada (Central)
209
	 * * `cn-north-1` - China (Beijing)
210
	 * * `cn-northwest-1` - China (Ningxia)
211
	 * * `eu-central-1` - EU (Frankfurt)
212
	 * * `eu-west-1` - EU (Ireland)
213
	 * * `eu-west-2` - EU (London)
214
	 * * `eu-west-3` - EU (Paris)
215
	 * * `eu-north-1` - EU (Stockholm)
216
	 * * `sa-east-1` - South America (São Paulo)
217
	 * * `us-gov-east-1` - AWS GovCloud (US-East)
218
	 * * `us-gov-west-1` - AWS GovCloud (US)
219
	 */
220
	region?:
221
		| 'us-east-2'
222
		| 'us-east-1'
223
		| 'us-west-1'
224
		| 'us-west-2'
225
		| 'ap-east-1'
226
		| 'ap-south-1'
227
		| 'ap-northeast-2'
228
		| 'ap-southeast-1'
229
		| 'ap-southeast-2'
230
		| 'ap-northeast-1'
231
		| 'ca-central-1'
232
		| 'cn-north-1'
233
		| 'cn-northwest-1'
234
		| 'eu-central-1'
235
		| 'eu-west-1'
236
		| 'eu-west-2'
237
		| 'eu-west-3'
238
		| 'eu-north-1'
239
		| 'sa-east-1'
240
		| 'us-gov-east-1'
241
		| 'us-gov-west-1'
242
	/**
243
	 * The [AWS Access Key](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html#access-keys-and-secret-access-keys).Required for S3 sources, invalid for all others.
244
	 */
245
	access_key?: string
246
	/**
247
	 * The [AWS Secret Access Key](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html#access-keys-and-secret-access-keys).Required for S3 sources, invalid for all others.
248
	 */
249
	secret_key?: string
250
	/**
251
	 * The GCS or [S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html) prefix. Optional for GCS and S3 sourcse, invalid for HTTP.
252
	 */
253
	prefix?: string
254
	/**
255
	 * The GCS email address for authentication. Required for GCS sources, invalid for all others.
256
	 */
257
	client_email?: string
258
	/**
259
	 * The GCS private key. Required for GCS sources if not using impersonated tokens. Invalid for all others.
260
	 */
261
	private_key?: string
262
	[k: string]: unknown
263
}
264