Skip to content

Can't use Sandbox to show previews #420

Open
@johannes-lindgren

Description

@johannes-lindgren

Describe the bug

Both the sandbox and editor (in Storyblok) has an input field where you can specify the URL of the field plugin:

image

But the field plugin is now refusing to post message to any other host than app.storyblok.com, meaning that you can't display previews anymore.

For example, the code block field plugin uses an older version of the library, which means that you can preview it with a Vercel preview:

https://plugin-sandbox.storyblok.com/field-plugin?url=https%3A%2F%2Fstoryblok-code-block.vercel.app%2F

image

But this doesn't work with the latest version of the library.

To Reproduce

Try to use the sandbox or editor with any field plugin on the most recent version:

  1. If you're not serving in dev mode, you won't be able to use the sandbox
  2. If you're not serving in production mode, you won't be able to use the editor

Or try to use the sandbox in local development mode:

image

See https://plugin-sandbox.storyblok.com/field-plugin?url=https%3A%2F%2Fstoryblok-code-block.vercel.app%2F

Expected behavior

For previews to work again, as outlined in the docs: https://www.storyblok.com/docs/plugins/field-plugins/continuous-delivery#preview-urls

Cause

This line:

  // ToDo: In development we need to load localhost:3300
  const origin =
    typeof targetOrigin === 'string'
      ? targetOrigin
      : host === 'plugin-sandbox.storyblok.com'
        ? 'https://plugin-sandbox.storyblok.com'
        : 'https://app.storyblok.com'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions