JSON and Math are empty inside sandbox functions, so any function that uses them fails on every run
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
調査の方向性
リンク先の lib/services/ai-functions/sandbox-worker.cjs の行から始め、サンドボックスが JSON と Math をコピーする箇所を確認し、既存のサンドボックス関数のテストを探します。関連するテストを実行し、サンドボックス関数内で JSON.stringify と Math のメソッドの両方を呼び出すテストを1つ追加します。両方の組み込みオブジェクトがそこで動作し、テストが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Sandbox functions (every trigger except http: on_signup, row events, schedules, on_webhook and manual) run in a vm context whose JSON and Math are frozen copies made with Object.assign:
Object.assign copies only enumerable own properties, and the built-in methods (JSON.stringify, JSON.parse, Math.round, Math.random and the rest) are not enumerable. Both copies are empty objects, and they shadow the context's own JSON and Math. A function that calls any of them throws TypeError: JSON.stringify is not a function (or Math.round is not a function) on every run.
Generated and agent-written functions use these all the time: Math.round(amount * 100) for a Stripe amount, JSON.stringify for a request body or a log line.
The same construction outside the worker:
const vm = require('vm')
const frozenJSON = Object.freeze(Object.assign(Object.create(null), JSON))
const context = vm.createContext(Object.assign(Object.create(null), { JSON: frozenJSON }))
vm.runInContext('typeof JSON.stringify', context) // 'undefined'
vm.runInContext('JSON.stringify({ a: 1 })', context) // TypeError: JSON.stringify is not a function
Or deploy a manual function whose body is return JSON.stringify({ a: 1 }) and run it.
Done when JSON and Math work inside the sandbox, with a test that runs a sandbox function using both.
- 主要言語
- TypeScript
- スター
- 56
- フォーク
- 19
- 平均マージ
- 14時間 4分
- マージ済み PR(30日)
- 366
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
backenly/backenly のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
メンテナーはふだん 1 日以内に返信
-
ctx.db treats { column: null } as = NULL, so query, update and delete match no rows対応中かも @akashr001 が 3 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 77/100
backenly/backenly#602 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Signed uploads that never finish leave files that are listed and metered but cannot be downloadedオープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
backenly/backenly の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AykutSarac/jsoncrack.com#616 ·
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtag対応中かも @bardrop が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
nbd-wtf/nostr-tools#578 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
backnotprop/plannotator#3427 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/Power-CAT-Copilot-Studio-Kit#942 ·
メンテナーはふだん 1 日以内に返信
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument pageオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/DebateAI#801 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信