Troubleshooting

Self-Signed TLS Certificate

If you are running API Platform on development machine which does not have valid TLS certificate, add NODE_TLS_REJECT_UNAUTHORIZED=0 before running create-client:

有効な TLS 証明書を持たない開発マシンで API プラットフォームを実行している場合は、create-client を実行する前に NODE_TLS_REJECT_UNAUTHORIZED=0 を追加します。

NODE_TLS_REJECT_UNAUTHORIZED=0 npm init @api-platform/client --generator typescript https://127.0.0.1:8000/api src/

Authenticated API

The generator does not perform any authentication, so you must ensure that all referenced Hydra paths for your API are accessible anonymously. If you are using API Platform this will at least include:

ジェネレーターは認証を実行しないため、API で参照されるすべての Hydra パスに匿名でアクセスできるようにする必要があります。 API プラットフォームを使用している場合、これには少なくとも以下が含まれます。

api_entrypoint                             ANY      ANY      ANY    /{index}.{_format}
api_doc                                    ANY      ANY      ANY    /docs.{_format}
api_jsonld_context                         ANY      ANY      ANY    /contexts/{shortName}.{_format}

ApiDocumentation doesn't exist

If you receive Error: The class http://www.w3.org/ns/hydra/core#ApiDocumentation doesn't exist. you may have specified the documentation URL instead of the entrypoint. For example if you are using API Platform and your documentation URL is at https://demo.api-platform.com/docs the entry point is likely at https://demo.api-platform.com. You can see an example of the expected response from an entrypoint in your browser by visiting https://demo.api-platform.com/index.jsonld.

エラーが発生した場合: クラス http://www.w3.org/ns/hydra/core#ApiDocumentation が存在しません。エントリポイントの代わりにドキュメントの URL を指定した可能性があります。たとえば、API プラットフォームを使用していて、ドキュメントの URL が https://demo.api-platform.com/docs にある場合、エントリ ポイントはおそらく https://demo.api-platform.com になります。 https://demo.api-platform.com/index.jsonld にアクセスすると、ブラウザーのエントリポイントからの期待される応答の例を確認できます。

Cannot read property '@type'

If you receive TypeError: Cannot read property '@type' of undefined or TypeError: Cannot read property '0' of undefined check that the URL you specified is accessible and returns jsonld. You can check from the command line you are using by running something like curl https://demo.api-platform.com/.

TypeError: Cannot read property '@type' of undefined または TypeError: Cannot read property '0'of undefined を受け取った場合は、指定した URL にアクセスできることを確認し、jsonld を返します。 curl https://demo.api-platform.com/ などを実行して、使用しているコマンド ラインから確認できます。

Dereferencing a URL did not result in a JSON object

If you receive a message like this:

次のようなメッセージが表示された場合:

{ Error
at done (/usr/local/share/.config/yarn/global/node_modules/jsonld/js/jsonld.js:6851:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
name: 'jsonld.InvalidUrl',
message: 'Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.',
details:
{ code: 'invalid remote context',
url: 'https://demo.api-platform.com/contexts/Entrypoint',
cause: null } }

Check access to the specified URL, in this case https://demo.api-platform.com/contexts/Entrypoint, use curl to check access and the response curl https://demo.api-platform.com/contexts/Entrypoint. In the above case an "Access Denied" message in JSON format was being returned.

指定された URL へのアクセスを確認します。この場合は https://demo.api-platform.com/contexts/Entrypoint です。curl を使用してアクセスを確認すると、応答は curl https://demo.api-platform.com/contexts/Entrypoint になります。上記の場合、JSON 形式の「アクセスが拒否されました」というメッセージが返されました。

Docker distribution on Windows and hot-reloading

Due to a long-time known Docker for Windows issue, the files changes on the host are not notified on the pwa container. It causes the hot-reloading feature to not working properly for Windows users.

Docker for Windows で以前から知られている問題により、ホスト上のファイルの変更が pwa コンテナーに通知されません。これにより、ホット リロード機能が Windows ユーザーに対して適切に機能しなくなります。