Request headers when using service binding

I am trying to use service bindings. When passing headers, the receiving services does not get the headers.

Tried creating new request as well as cloning the main request.

any ideas?

How are you calling the bound worker? Are you not passing the request through to it?

I tried passing the request as is
cloning the request
creating new request.

All of this on local though

Could you please share the code snippet?

This is the calling service:

type Environment = {
  auth: ExportedHandler<Environment, any, ExecutionContext>
  userStorage: R2Bucket
  F_PROJECT_ID: string;
}

const worker: ExportedHandler<Environment, any, ExecutionContext> = {

  async fetch(request: Request<ExecutionContext, IncomingRequestCfProperties<ExecutionContext>>, env: Environment, ctx: ExecutionContext) {

    try {

      if (!env.auth || !env.auth.fetch) {
        console.log('Missing auth handler');
        throw new KnownError('Missing auth handler');
      }

      if (!env.F_PROJECT_ID || typeof env.F_PROJECT_ID === 'undefined') {
        console.log('Missing project id');
        throw new KnownError('Missing project id');
      }

      if (request.method === 'OPTIONS') {
        return new Response(null, {
          status: 204,
          headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': 'PUT, OPTIONS, GET, DELETE, POST, HEAD',
            'Access-Control-Allow-Headers': 'Content-Type, Authorization',
          },
        });
      }

      const authResponse = await env.auth.fetch(request.clone(), env, ctx);

This is the bound service

const handler: ExportedHandler = {

  async fetch(request: Request) {

    console.log(request.headers);
    console.log(request.method);

    try {
      if (request.method === 'OPTIONS') {
        return new Response(null, {
          status: 204,
          headers: {
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': 'OPTIONS, GET, POST',
            'Access-Control-Allow-Headers': 'Authorization, ' + FB_PROJECT_HEADER,
          },
        });
      }

The bound service does get headers

Rather than an ExportedHandler, the bound worker is a Fetcher as shown in the Service bindings → #interface example.

declare abstract class Fetcher {
  fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
}

so should read

type Environment = {
  auth: Fetcher
}

Above: type definition from @cloudflare/workers-types

I fetch from the bound worker exactly as described in the Service bindings documentation

return env.BOUND.fetch(request)

and the bound worker has access to the the original request headers (which I use.)