builder icon indicating copy to clipboard operation
builder copied to clipboard

"[Builder.io]: Failed code evaluation: Code generation from strings disallowed for this context"

Open ijustwannacodetoday opened this issue 10 months ago • 3 comments

Describe the bug Element data bindings don't work when a Qwik app is deployed to Cloudflare Pages.

To Reproduce Steps to reproduce the behavior:

  1. Create a Qwik app.
  2. Add a Cloudflare Pages adapter.
  3. In Builder, create a section model.
  4. In code, pass data bindings (state) along with apiKey, model, and content:
<Content apiKey={BUILDER_PUBLIC_API_KEY} model={BUILDER_MODEL} content={content} data={{username: 'SuperUser'}}
  1. In Builder, in Content, add a New Entry for your section model.
  2. In Builder, in Editor, add the Basic > Text component.
  3. In Builder, in Options panel, bind text to dynamic data (state).
  4. In Builder, publish.
  5. In code, deploy.

Expected behavior Text bound to dynamic data shows up not just in Editor and local environment, but also when deployed to Cloudflare Pages.

Screenshots Real-time Logs for Functions for deployment in Cloudflare dashboard show errors:

    {
      "message": [
        "[Builder.io]: ",
        "Failed code evaluation: Code generation from strings disallowed for this context",
        {
          "code": "var _virtual_index=state.username;return _virtual_index"
        }
      ],
      "level": "error",
      "timestamp": 1712461956369
    },

Additional context

  1. Per reports of this error message on the Cloudflare side, it's expected: they don't allow evaluating for security and performance.
  2. Similar report on Builder.io Forum: https://forum.builder.io/t/data-binding-works-in-builder-but-broken-on-deploy/5302

ijustwannacodetoday avatar Apr 07 '24 03:04 ijustwannacodetoday

Thank you for the detailed report @ijustwannacodetoday ! We will let you know when we have an update on the root cause and/or have a workaround for you.

mrkoreye avatar Apr 09 '24 15:04 mrkoreye

Hi @mrkoreye, has your team had a chance to review this? Is there an approximate timeline for getting this resolved? This is a blocker for my project, where I relied on Sections showing data (state) passed from my back end.

ijustwannacodetoday avatar Apr 19 '24 22:04 ijustwannacodetoday

Hi @ijustwannacodetoday , unfortunately there is not approximate timeline for resolution at this time.

mrkoreye avatar Apr 19 '24 22:04 mrkoreye