1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

UI5アプリからCAP ODataを呼び出すときのタイムアウト設定

Last updated at Posted at 2025-08-23

課題

UI5アプリからCAPで作成したODataを呼び出したところ、504エラー(Gateway Timeout)が発生しました。

デフォルトでは30秒でTimeoutする設定になっていそうです。

image.png

対応策

mta.yamlにてTimeout時間を指定します。

HTML5.Timeoutというプロパティにミリ秒単位でTimeout時間を設定します。

(デプロイ後にBTP CockpitのDestinationタブから対象のDestinationを開くと、プロパティHTML5.Timeoutが追加されていることを確認できます。)

mta.yaml
- name: test-destination-content
  type: com.sap.application.content
  requires:
  - name: test-destination-service
    parameters:
      content-target: true
  - name: test_html_repo_host
    parameters:
      service-key:
        name: test_html_repo_host-key
  - name: test-auth
    parameters:
      service-key:
        name: test-auth-key
  - name: srv-api
  parameters:
    content:
      subaccount:
        destinations:
        - Name: cap_test_html_repo_host
          ServiceInstanceName: test-html5-app-host-service
          ServiceKeyName: test_html_repo_host-key
          sap.cloud.service: cap
        - Authentication: OAuth2UserTokenExchange
          Name: cap_test_auth
          ServiceInstanceName: test-auth
          ServiceKeyName: test-auth-key
          sap.cloud.service: cap
        - Authentication: OAuth2UserTokenExchange
          Name: cap_test_srv
          ServiceInstanceName: test-auth
          ServiceKeyName: test-auth-key
          sap.cloud.service: cap
          URL: ~{srv-api/srv-url}
          HTML5.DynamicDestination: true
          HTML5.Timeout: 300000 //ミリ秒単位で設定

UI5からODataを呼び出したところ、Timeoutエラーが発生せず、処理が正常完了しました!

image.png

補足

本記事では「30 秒以上レスポンスが返らないケース」でのTimeout挙動を確認するため、CAP 側で意図的に60秒待ってからレスポンスを返すエンドポイントを作成しました。

実運用ではパフォーマンスチューニングや非同期化により、長時間待ちが発生しないよう工夫すべきだと考えます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?