Gatsby: Creating pages with parenthesis in the path using createPage fails silently

Created on 6 Jul 2018  路  4Comments  路  Source: gatsbyjs/gatsby

Description

Having parenthesis in the path when using the createPage api isn't creating the pages even though they appear in the Dev 404 page. No error is shown

Steps to reproduce

  • Create new project
  • Use the createPage api and have a ( or a ) in the path
createPage({
        path: `/article/url(testing)`,
        component: path.resolve(`src/template/template.js`),
      })

Expected result

There can be two expected results for this:

  • Failure to create the page because there were parenthesis in the path.
  • Success in creating the page

Actual result

No errors are shown when creating the pages.
The url is listed in the 404 page but there's no page being created

Environment

System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.9.1 - ~/.nvm/versions/node/v8.9.1/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.0.1 - ~/.nvm/versions/node/v8.9.1/bin/npm
Browsers:
Chrome: 67.0.3396.99
Firefox: 60.0.2
Safari: 11.1.1
npmPackages:
gatsby: ^1.9.273 => 1.9.273
gatsby-link: ^1.6.40 => 1.6.45
gatsby-plugin-react-helmet: ^2.0.10 => 2.0.11
npmGlobalPackages:
gatsby-cli: 1.1.58

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js:

const path = require(`path`)

const makeRequest = (graphql, request) =>
  new Promise((resolve, reject) => {
    // Query for nodes to use in creating pages.
    resolve(
      graphql(request).then(result => {
        if (result.errors) {
          reject(result.errors)
        }

        return result
      })
    )
  })

exports.createPages = ({ boundActionCreators, graphql }) => {
  const { createPage } = boundActionCreators
  const getArticles = makeRequest(
    graphql,
    `
    {
      site{
        siteMetadata {
          title
        }
      }
    }
    `
  )
    .then(result => {
      createPage({
        path: `/article/url(testing)`,
        component: path.resolve(`src/template/template.js`),
      })
    })
    .catch(err => console.log('ERROR CREATING PAGES: ', err))

  return Promise.all([getArticles])
}

gatsby-browser.js: N/A
gatsby-ssr.js: N/A

help wanted bug

All 4 comments

Thanks for the report @hugo-marques-m3! I can confirm I'm seeing something similar here so I'm going to mark this as a bug.

If you're able to create a small demo site for this issue, that might help anyone that wants to investigate.

I'd guess that digging into the createPage action or the writePages function would be good places to try and work out what's happening here.

Hi @m-allanson, I've created this https://github.com/Hsmarques/gatsby-issue-6323. Hope that helps.

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

I know you have closed this issue but we have faced that exact same issue now. seems Gastby is converting parenthesis to different character. we re investigating more but wanted to let you know and find out if someone has faced this issues and resolved it already.

BTW, it seems we also have the same issue with + in the URL like iphone-8+ and iphone-8 in urls are considered same things in gatsby therefore created pages are similar while content should be different.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kalinchernev picture kalinchernev  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments

magicly picture magicly  路  3Comments

KyleAMathews picture KyleAMathews  路  3Comments

jimfilippou picture jimfilippou  路  3Comments