Coder Social home page Coder Social logo

repro-wrangler-circular-services's Introduction

repro-wrangler-circular-services

Reproduction of Cloudflare Workers circular service dependency.

Local

Working scenario

  • Run npm i to restore dependencies
  • Run npm ls wrangler and confirm wrangler is at 3.18.0
  • In separate terminals:
    • npm start -w worker-a
    • npm start -w worker-b
    • npm start -w worker-c
  • Observe that wrangler restarts the dev server once for each npm start
  • Send an HTTP POST request to a Worker
  • Observe that the request is forwarded to the correct Worker through the service binding

Failing scenario

  • Update wrangler with npm i -D wrangler@latest or any version >=3.19.0
  • Run npm ls wrangler and confirm that wrangler is at 3.19.0 or higher
  • In separate terminals:
    • npm start -w worker-a
    • npm start -w worker-b
    • npm start -w worker-c
  • Observe that wrangler restarts the dev servers repeatedly

Deploying

A Worker will not deploy if the service binding cannot be found, so one Worker must be deployed without the service binding initially. The remaining Workers can be deployed in the correct dependency sequence, then the original Worker can be redeployed with the service binding.

  • Remove/comment [[services]] block in worker-a/wrangler.toml
  • Run npm run deploy -w worker-a
  • Run npm run deploy -w worker-c
  • Run npm run deploy -w worker-b
  • Reintroduce [[services]] block in worker-a/wrangler.toml
  • Run npm run deploy -w worker-a
  • Send an HTTP POST request to a deployed Worker
  • Observe that the request is forwarded to the correct Worker through the service binding

This demonstrates that the Cloudflare Workers runtime supports circular service dependencies with no noticeable issues.

repro-wrangler-circular-services's People

Contributors

rtbenfield avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.