Skip to content

Commit

Permalink
Fix #1197
Browse files Browse the repository at this point in the history
  • Loading branch information
penalosa committed Sep 11, 2023
1 parent 0ba5884 commit 66e7236
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/wrangler/src/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ export default async function deploy(props: Props): Promise<void> {
} catch (e) {
// code: 10090, message: workers.api.error.service_not_found
// is thrown from the above fetchResult on the first deploy of a Worker
if ((e as { code?: number }).code !== 10090) {
if (
(e as { code?: number }).code !== 10090 &&
(e as { code?: number }).code !== 10000
) {
logger.error(e);
}
}
Expand Down Expand Up @@ -1001,7 +1004,7 @@ async function publishRoutesFallback(
return deployedRoutes;
}

function isAuthenticationError(e: unknown): e is ParseError {
export function isAuthenticationError(e: unknown): e is ParseError {
return e instanceof ParseError && (e as { code?: number }).code === 10000;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/wrangler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { constellation } from "./constellation";
import { d1 } from "./d1";
import { deleteHandler, deleteOptions } from "./delete";
import { deployOptions, deployHandler } from "./deploy";
import { isAuthenticationError } from "./deploy/deploy";
import { isBuildFailure } from "./deployment-bundle/bundle";
import {
deployments,
Expand Down Expand Up @@ -721,6 +722,9 @@ export async function main(argv: string[]): Promise<void> {
// The workaround is to re-run the parsing with an additional `--help` flag, which will result in the correct help message being displayed.
// The `wrangler` object is "frozen"; we cannot reuse that with different args, so we must create a new CLI parser to generate the help message.
await createCLIParser([...argv, "--help"]).parse();
} else if (isAuthenticationError(e)) {
logger.log(formatMessage(e));
await whoami();
} else if (e instanceof ParseError) {
e.notes.push({
text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose",
Expand Down

0 comments on commit 66e7236

Please sign in to comment.