"Cannot stringify arbitrary non-POJOs" error in Nuxt projects
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- nuxtjs, typescript
- 領域
- frontend
調査の方向性
Nuxt ジェネレーターコマンドと生成された Animal ページで失敗を再現します。nuxt.config.js、./nuxt/stores/animal/list.ts、./composables/api.ts を調査し、提案されている payload と shallowRef の回避策を比較します。生成された Nuxt 3.4+ クライアントが「Cannot stringify arbitrary non-POJOs」エラーなしでリソースを読み込めれば完了です。
索引モデルが issue の本文から書いたものです。
説明
API Platform version(s) affected: 3.2.18
Description
Clients generated for Nuxt will fail with: "Cannot stringify arbitrary non-POJOs"
How to reproduce
- Create an Entity e.g. "Animal"
- Create a Nuxt project
- Create a client (e.g.
yarn create @api-platform/client https://localhost/ . --generator nuxt --resource animal) - Load https://localhost/animal
You'll get a message saying: "Cannot stringify arbitrary non-POJOs"
Possible Solution
- One solution is to edit
nuxt.config.jsand add the following:
experimental: {
renderJsonPayloads: false,
},
- Another possible solution is to edit
./nuxt/stores/animal/list.tsand addshallowRef()tosetHubUrlfunction:
setHubUrl(hubUrl?: URL) {
this.hubUrl = shallowRef(hubUrl);
},
- Another solution is to edit
./composables/api.tsand addshallowRef() to allonResponse()` functions.
Additional Context
This is occurring with all projects using Nuxt 3.4 or later.
More info at: https://nuxt.com/blog/v3-4#payload-enhancements
- 主要言語
- TypeScript
- スター
- 376
- フォーク
- 132
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
api-platform/create-client のほかの issue
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/[email protected]` オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
api-platform/create-client#396 ·
-
[potential Security Alert] New `test-nuxt-app` script added in `@api-platform/[email protected]` オープン
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
api-platform/create-client#397 ·
-
[potential Security Alert] New `test-next-app` script added in `@api-platform/[email protected]` オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
api-platform/create-client#395 ·
-
[potential Security Alert] New `test-react-app` script added in `@api-platform/[email protected]` オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
api-platform/create-client#394 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
api-platform/create-client#393 · コメント 1 件 ·
api-platform/create-client の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
security
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
IBM/node-sdk-core#373 ·
-
e2e-failure ready-to-code
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
chore
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100