cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.7k stars 709 forks source link

🐛 BUG: Interactive metrics makes CircleCI jobs fails (timeout) #1480

Closed thibault-deriv closed 2 years ago

thibault-deriv commented 2 years ago

What version of Wrangler are you using?

2.0.21

What operating system are you using?

Linux

Describe the Bug

Hello :smiley:

First, thank you for wrangler2 :+1:

With wrangler@2.0.21, the client is asking for (y/n) about metrics that makes CircleCI fails:

🌏  Uploading... (1/1)

✨ Success! Uploaded 1 files (2.35 sec)

✨ Deployment complete! Take a peek over at https://4a05b732.interactive-metrics.pages.dev
▲ [WARNING] Unrecognised input: `

Would you like to help improve Wrangler by sending usage metrics to Cloudflare?
(y/n)

Too long with no output (exceeded 10m0s): context deadline exceeded

2.0.21

interactive

2.0.19

not-interactive

You can highlight this issue with this CircleCI config (add CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID secrets in settings):

version: 2.1

jobs:
  not_interactive:
    docker:
      - image: cimg/node:18.4.0
    steps:
      - run:
          name: "Publish to cloudflare pages (not interactive)"
          command: |
            npm i wrangler@2.0.19
            mkdir public
            cd public
            echo "Hello not interactive" >> index.html
            npx wrangler pages publish . --project-name=interactive-metrics --branch=not
  interactive:
    docker:
      - image: cimg/node:18.4.0
    steps:
      - run:
          name: "Publish to cloudflare pages (interactive)"
          command: |
            npm i wrangler@2.0.21
            mkdir public
            cd public
            echo "Hello interactive" >> index.html
            npx wrangler pages publish . --project-name=interactive-metrics --branch=main

workflows:
  release_not_interactive:
    jobs:
      - not_interactive:
          filters:
            branches:
              only: /^main$/
  release_interactive:
    jobs:
      - interactive:
          filters:
            branches:
              only: /^main$/

wrangler@2.0.19 is fine.

2.0.21 versus 2.0.19

interactive-not-interactive

I see from documentation that we can configure the option in wrangler.toml, but I think it would be better to do not ask at all when detecting it's running in CI (like npx does, no idea how exactly) and even in a more general manner probably to do not make wrangler fails for such a side tasks (upload was OK).

Thank you in advance!

Thibault

petebacondarwin commented 2 years ago

Agh! So sorry. I made the assumption that CI runs would be non-interactive, which causes the Wrangler metrics to noop. I can see that CircleCI is running in an interactive mode, so we need to have a better check. I'll get a fix out today.

thibault-deriv commented 2 years ago

It would be great, thank you so much

petebacondarwin commented 2 years ago

Here's the fix https://github.com/cloudflare/wrangler2/pull/1482