Service binding via wrangler

I’m not able to bind services via wrangler.
If I create a binding via the UI, it works fine and I’m able to make a fetch call like this:

/* global API, FORMDATA_SERVICE_KEY */
await API.fetch(new Request(uri, {
        method: 'GET',
        headers: { 'Authorization': SERVICE_KEY}
    }))

API is the name of the binding.

However, once I publish the worker via wrangler, this binding is deleted.
I’ve tried setting up the binding in wrangler.toml like this (spec here)

[[services]]
binding = "API"
service = "api"
environment = "production"

and also like this (mentioned here)

services = [
  { binding = "API", service = "api", environment = "production" }
]

Any clue?

I think I figured it out - binding is only possible using wrangler 2…

But now I have a new issue - migrating to wrangler 2 is not possible at the moment for me.
It is too much work and requires a lot of testing.

  1. I need to make changes to all my build/test/deploy scripts
  2. Wrangler 2 requires node 16.x, while I currently use 14.x. I start getting many errors from 3rd party modules such as jsonwebtoken due to the use of crypto package that has changed.

I think there should be an easier migration path, or the requirements for wrangler2 should be loosen-up /-: