danielmahon/gatsby-remark-relative-images

The "path" argument must be a type of string. (breaks on upgrade from 0.2.3 to 0.3.0

tr1s opened this issue · 9 comments

tr1s commented

I had to trial an error update all my packages to find it was this plugin causing the error. It wasn't very descriptive.

0.2.3 works fine, but 0.3.0 breaks.

This is the error:

CleanShot 2020-07-31 at 11 52 58@2x

CleanShot 2020-07-31 at 11 53 21@2x

This is my config:

    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `src`,
        path: `${__dirname}/src/`
      }
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/assets/images/`
      }
    },

......

{
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-source-contentful`,
            options: {
              spaceId: process.env.CONTENTFUL_SPACE_ID,
              accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
              host: process.env.CONTENTFUL_HOST
            }
          },
          `gatsby-remark-relative-images`,
          {
            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 750,
              linkImagesToOriginal: false
            }
          }
        ]
      }
    },

Any ideas as to what's going on? Apparently it's saying my paths aren't strings anymore, but nothing has changed.

@tr1s, were you able to get this solved?

tr1s commented

@ttstauss I originally went back to the version that wasn't breaking. Then the problem came up again randomly, but then @danielmahon made a big PR and closed a bunch of issues.

Right after he did that I upgraded to the beta 1.0.0-rc.5 and it seemed to be fine!

@tr1s, thanks for getting back to me so fast.

Maybe I'm facing a different issue. My images are stored in a different folder (content/uploads).

Version 0.3.0 has worked fine for me but I can't get any upgrades to work—the version you recommended (1.0.0-rc.5) or the latest version 2.0.2 (after removing fmImagesToRelative).

I think I have my config set up correctly (added staticFolderName for the two newer versions):

  {
    resolve: `gatsby-source-filesystem`,
    options: {
      name: `content/uploads`,
      path: `${__dirname}/content/uploads`,
    },
  },
  {
    resolve: `gatsby-source-filesystem`,
    options: {
      name: `content/pages`,
      path: `${__dirname}/content/pages`,
    },
  },
  {
    resolve: `gatsby-source-filesystem`,
    options: {
      name: `content/includes`,
      path: `${__dirname}/content/includes`,
    },
  },
  `gatsby-plugin-sharp`,
  `gatsby-transformer-sharp`,
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        `gatsby-transformer-remark-frontmatter`,
        {
          resolve: `gatsby-plugin-netlify-cms-paths`,
          options: {
            cmsConfig: `static/admin/config.yml`,
          },
        },
        {
          resolve: `gatsby-remark-relative-images`,
          options: {
            staticFolderName: `content/uploads`,
          },
        },
        {
          resolve: `gatsby-remark-images`,
          options: {
            maxWidth: 2048,
            linkImagesToOriginal: false,
            withWebp: true,
            quality: 80,
          },
        },
      ],
    },
  },

Anyway, I can't seem to figure it out, but I'll keep trying 😕

@ttstauss did you make any further progress with this? I seem to have the same issue that you were facing.

@donovantc, unfortunately, I haven't. I couldn't figure anything out. I had to move on for the time being. I plan on revisiting as soon as I can (I have a few other projects that could upgrade but face the same issue).

@ttstauss in the end I just downgraded back to 0.3.0 and it works fine. So if you are not using any specific features from 2.0.2, this might solve the issue for you as well. Good luck.

Yeah this is still an issue in 2.0.2... Able to reproduce as well

Any updates on this? I seem to be having the same issue when i run gatsby build. Everything works well in development mode but I get the error when i try to build my project. I can't seem to get this to work.

I'm currently using Gatsby v. 3.0.1 and gatsby-remark-relative-images v. 2.0.2. Is there anyway I can get this to work?

Any updates on this? I seem to be having the same issue when i run gatsby build. Everything works well in development mode but I get the error when i try to build my project. I can't seem to get this to work.

I'm currently using Gatsby v. 3.0.1 and gatsby-remark-relative-images v. 2.0.2. Is there anyway I can get this to work?

Did you end up finding a solution?