Skip to content

Commit 5bfb489

Browse files
sunnylqmclaude
andcommitted
fix(publish): keep publishing when the server rejects the source-map upload
Servers without source-map archiving (self-hosted or not yet rolled) answer the .map upload with 400; that now degrades to a warning instead of failing the whole publish. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018tGFyF841jinkhw1933Zwp
1 parent 3d39e48 commit 5bfb489

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/locales/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ This can reduce the risk of inconsistent dependencies and supply chain attacks.
134134
sourceMapMissingWarning:
135135
'No source map was archived with this version: crashes cannot be symbolicated later. Bundle with the default --sourcemap, or pass --sourcemap <file> to publish.',
136136
sourceMapArchived: 'Source map archived with version {{id}}',
137+
sourceMapUploadFailedWarning:
138+
'Source map upload failed ({{error}}); publishing without an archived map. Upgrade the update server to archive source maps.',
137139
symbolicateUsage:
138140
'Usage: pushy symbolicate <stack file | -> --hash <updateHash> [--platform ios|android|harmony] [--output <file>]',
139141
symbolicateVersionNotFound:

src/locales/zh.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ export default {
122122
sourceMapMissingWarning:
123123
'本版本没有归档 source map,之后的崩溃堆栈将无法还原。请用默认的 --sourcemap 打包,或在 publish 时传 --sourcemap <文件>。',
124124
sourceMapArchived: 'source map 已随版本 {{id}} 归档',
125+
sourceMapUploadFailedWarning:
126+
'source map 上传失败({{error}}),本次发布不归档 map。升级更新服务端后可归档 source map。',
125127
symbolicateUsage:
126128
'用法:pushy symbolicate <堆栈文件 | -> --hash <热更 hash> [--platform ios|android|harmony] [--output <文件>]',
127129
symbolicateVersionNotFound: '当前应用下找不到 hash 为 {{hash}} 的已发布版本',

src/versions.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,15 +553,36 @@ export const versionCommands = {
553553
// of the upload, so they overlap with it instead of running afterwards.
554554
// describePpkBundle never rejects (best effort); a failed upload still
555555
// fails the publish exactly as before.
556+
// A server that predates source-map archiving (self-hosted, or a SaaS
557+
// region not yet rolled) rejects the .map upload with 400; that must not
558+
// fail the publish, only lose the archive.
559+
let sourceMapUploadError: unknown;
556560
const [{ hash }, bundleMeta, commit, sourceMapUpload] = await Promise.all([
557561
uploadFile(fn, undefined, appId),
558562
describePpkBundle(fn, options.hermesBase),
559563
getCommitInfo(),
560564
sourcemapPath
561-
? uploadFile(sourcemapPath, undefined, appId)
565+
? uploadFile(sourcemapPath, undefined, appId).catch(
566+
(error: unknown) => {
567+
sourceMapUploadError = error;
568+
return undefined;
569+
},
570+
)
562571
: Promise.resolve(undefined),
563572
]);
564573
const sourceMapKey = sourceMapUpload?.hash;
574+
if (sourcemapPath && !sourceMapKey) {
575+
console.log(
576+
chalk.yellow(
577+
t('sourceMapUploadFailedWarning', {
578+
error:
579+
sourceMapUploadError instanceof Error
580+
? sourceMapUploadError.message
581+
: String(sourceMapUploadError),
582+
}),
583+
),
584+
);
585+
}
565586
const depVersions = getDepVersions();
566587

567588
const versionName =

0 commit comments

Comments
 (0)