BuilderIO / builder

Visual Development for React, Vue, Svelte, Qwik, and more
https://builder.io
MIT License
7.58k stars 950 forks source link

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

Open ijustwannacodetoday opened 7 months ago

ijustwannacodetoday commented 7 months ago

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'}}
  5. In Builder, in Content, add a New Entry for your section model.
  6. In Builder, in Editor, add the Basic > Text component.
  7. In Builder, in Options panel, bind text to dynamic data (state).
  8. In Builder, publish.
  9. 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
mrkoreye commented 7 months ago

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.

ijustwannacodetoday commented 7 months ago

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.

mrkoreye commented 7 months ago

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