google document ai api request contains an invalid argument

I created a simple node api as follows

router.post('/extract-text', auth, async (req, res) => {
  try {
    const { gcsUri } = req.body;

    if (!gcsUri) {
      return res.status(400).json({ message: 'GCS URI is required' });
    }

    const request = {
      name: `projects/project_name/locations/us/processors/759ef192d97e542c`,
      rawDocument: {
        gcsUri: gcsUri,
        mimeType: 'application/pdf',
      },
    };

    const [response] = await client.processDocument(request);
    console.log(response.document.text);
    res.status(200).json(response.document.text);
  } catch (error) {
    console.error('Error extracting text from document:', error);
    res.status(500).json({ message: 'Failed to extract text from document' });
  }
});

I created a bucket in the same project and uploaded a pdf file in bucket after trying this api on postman I am getting the following error,

Error extracting text from document: Error: 3 INVALID_ARGUMENT: Request contains an invalid argument.
    at callErrorFromStatus (/Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/client.js:193:76)
    at Object.onReceiveStatus (/Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)
    at Object.onReceiveStatus (/Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
    at /Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/resolving-call.js:129:78
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (/Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/client.js:161:32)
    at ServiceClientImpl.<anonymous> (/Users/anshul/mvp/server/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
    at /Users/anshul/mvp/server/node_modules/@google-cloud/documentai/build/src/v1/document_processor_service_client.js:326:29
    at /Users/anshul/mvp/server/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16
    at repeat (/Users/anshul/mvp/server/node_modules/google-gax/build/src/normalCalls/retries.js:80:25)
    at /Users/anshul/mvp/server/node_modules/google-gax/build/src/normalCalls/retries.js:119:13
    at OngoingCallPromise.call (/Users/anshul/mvp/server/node_modules/google-gax/build/src/call.js:67:27)
    at NormalApiCaller.call (/Users/anshul/mvp/server/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)
    at /Users/anshul/mvp/server/node_modules/google-gax/build/src/createApiCall.js:112:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 3,
  details: 'Request contains an invalid argument.',
  metadata: Metadata {
    internalRepr: Map(5) {
      'endpoint-load-metrics-bin' => [Array],
      'grpc-server-stats-bin' => [Array],
      'pc-high-bwd-bin' => [Array],
      'google.rpc.badrequest-bin' => [Array],
      'grpc-status-details-bin' => [Array]
    },
    options: {}
  },
  note: 'Exception occurred in retry method that was not classified as transient',
  statusDetails: [ BadRequest { fieldViolations: [Array] } ]
}

I don’t understand this error as I am not passing arguments here.

I have gone through this link
and ran this command too
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID –member “serviceAccount:NAME@YOUR_PROJECT_ID.iam.gserviceaccount.com” –role “roles/owner”
but same error persists.

Edit: It seems this should be gcsDocument not rawDocument in request. (Shouldn’t have trusted chatgpt).

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật