next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Error: Failed prop type: The prop `href` expects a `string` or `object` in `<Link>`, but got `null` instead.

Open 2dareis2do opened this issue 1 year ago • 1 comments

I have just done a fresh install of the Umami demo as shown here:

https://next-drupal.org/guides/umami-demo

One thing I noticed is that the patch for drupal/decoupled_router looks like it is out of date, at least it is a different version to the one shown here:

https://next-drupal.org/learn/quick-start/apply-patches

Also as i have set up the umami.demo on a self signed certificate I had to add NODE_TLS_REJECT_UNAUTHORIZED = "0" to my .env.local file.

Any way when launching localhost running npm run dev I get the following error?

error - node_modules/next/dist/client/link.js (75:19) @ createPropError
error - Error: Failed prop type: The prop `href` expects a `string` or `object` in `<Link>`, but got `null` instead.
    at createPropError (webpack-internal:///./node_modules/next/dist/client/link.js:75:20)
    at eval (webpack-internal:///./node_modules/next/dist/client/link.js:85:27)
    at Array.forEach (<anonymous>)

The odd thing this was kind of working previously on loading the home page, but threw a different error when navigating to sub pages, something about missing image paths. I was able to fix this by adding the following to next.config.js

module.exports = {
  i18n,
  images: {
    domains: [process.env.NEXT_IMAGE_DOMAIN],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'umami.internal',
        port: '443',
        pathname: 'sites/default/files/**',
      },
    ],
  },
}

2dareis2do avatar Apr 11 '23 18:04 2dareis2do

I had received the same error when adding nextjs on an existing local site: the reason was I had forgotten to add the path alias as described in https://next-drupal.org/learn/quick-start/configure-path-aliases

kopeboy avatar Oct 27 '23 10:10 kopeboy