workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: wrangler2 tries to open a browser to authenticate in CircleCI

Open thibault-deriv opened this issue 2 years ago • 1 comments

What version of Wrangler are you using?

2.0.23

What operating system are you using?

Linux

Describe the Bug

When publishing in CircleCI without providing a CLOUDFLARE_API_TOKEN, it tries to open a browser. It timeouts quickly, but I suppose ideally it should not try to open a browser at all.

Demo

version: 2.1
  
jobs:
  browser:
    docker:
      - image: cimg/node:18.4.0
    steps:
      - run:
          name: "Publish to cloudflare pages (KO)"
          command: |
            npm i [email protected]
            mkdir public
            cd public
            echo "Hello browser" >> index.html
            CLOUDFLARE_ACCOUNT_ID=abcd npx wrangler pages publish . --project-name=open-browser-in-circleci --branch=main
workflows:
  release_browser:
    jobs:
      - browser:
          filters:
            branches:
              only: /^main$/

Will produce: ko-browser-circleci

thibault-deriv avatar Aug 01 '22 16:08 thibault-deriv

Yeah, sorry about that. We do not try to open the browser if the terminal is non-TTY (non-interactive). But CircleCI actually has a TTY terminal so we get it wrong. For metrics capture we have gone with the is-ci approach, which looks for certain environment variables; so we should probably do the same here.

petebacondarwin avatar Aug 01 '22 17:08 petebacondarwin

Thank you! :+1: :+1:

thibault-deriv avatar Aug 17 '22 15:08 thibault-deriv

@thibault-deriv you should be able to use this fix via wrangler@beta - let me know if i've missed anything 👀

rozenmd avatar Aug 17 '22 15:08 rozenmd

@rozenmd Verified :smiley: well done!

beta

thibault-deriv avatar Aug 17 '22 16:08 thibault-deriv