mattmilburn / strapi-plugin-preview-button

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.
MIT License
100 stars 35 forks source link

TypeError: Cannot read properties of undefined (reading 'replace') #139

Open leonleles opened 1 month ago

leonleles commented 1 month ago

I am experiencing this error in production. The plugin works fine on localhost. What could be happening?

image image

 "preview-button": {
      config: {
        contentTypes: [
          {
            uid: 'api::country.country',
            draft: {
              url: process.env.URL_PAGE,
              query: {
                _preview: "true",
              },
            },
            published: {
              url: process.env.URL_PAGE,
            },
          },
          {
            uid: 'api::city.city',
            draft: {
              url: process.env.URL_PAGE,
              query: {
                _preview: "true",
              },
            },
            published: {
              url: process.env.URL_PAGE,
            },
          },
        ],
      },
    },
leonleles commented 1 month ago

I found that the plugin settings in the plugins.ts file are not injecting the env('URL_PAGE'). Do you have any idea how to fix it?

@strapi/strapi": "4.24.2