payload icon indicating copy to clipboard operation
payload copied to clipboard

plugin-seo: error building the application after adding the plugin to the project

Open AgrrFoss opened this issue 1 year ago • 2 comments

Hello, I used your plugin with Payload Cms 2.00 and did not encounter any problems. I am currently writing a project on Payload Cms 3.0 and now, after adding the SEO Plugin to an already completed project, I cannot launch it. I get the following error:

Image

Build Error
Next.js (15.0.0) out of date [(learn more)](https://nextjs.org/docs/messages/version-staleness)
Failed to compile

./node_modules/@payloadcms/plugin-seo/node_modules/@payloadcms/ui/dist/exports/client/index.js
Attempted import error: 'fieldIsID' is not exported from 'payload/shared' (imported as 'iP').

It's seoPlugin in payload.config.ts

export default buildConfig({
  serverURL: process.env.SERVICE_URL,
  admin: {
    user: Users.slug,
    importMap: {
      baseDir: path.resolve(dirname),
    },
  },
  collections: [Users, Media, Pages, Brands, Feedbacks, Articles, Countries, Tags, Comments],
  globals: [ Header, Footer, Options ],
  editor: lexicalEditor(),
  i18n: {
    fallbackLanguage: 'en',
    supportedLanguages: { en, ru}
  },
  secret: process.env.PAYLOAD_SECRET || '',
  typescript: {
    outputFile: path.resolve(dirname, 'payload-types.ts'),
  },
  db: postgresAdapter({
    pool: {
      connectionString: process.env.DATABASE_URI || '',
    },
  }),
  sharp,
  plugins: [
    seoPlugin({
      collections: [
        'pages'
      ],
      globals: ['options'],
      uploadsCollection: 'media',
    }),
    payloadCloudPlugin(),
  ],
})

my depencies in package.json:

"scripts": {
    "build": "cross-env NODE_OPTIONS=--no-deprecation next build",
    "dev": "cross-env NODE_OPTIONS=--no-deprecation next dev -p 5000",
    "devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
    "generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
    "generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
    "lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
    "payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
    "start": "cross-env NODE_OPTIONS=--no-deprecation next start"
  },
  "dependencies": {
    "@payloadcms/db-postgres": "latest",
    "@payloadcms/next": "latest",
    "@payloadcms/payload-cloud": "latest",
    "@payloadcms/plugin-seo": "^3.7.0",
    "@payloadcms/richtext-lexical": "latest",
    "@payloadcms/translations": "^3.2.2",
    "@svgr/webpack": "^8.1.0",
    "classnames": "^2.5.1",
    "cross-env": "^7.0.3",
    "graphql": "^16.8.1",
    "next": "15.0.0",
    "normalize.css": "^8.0.1",
    "payload": "latest",
    "react": "19.0.0-rc-65a56d0e-20241020",
    "react-dom": "19.0.0-rc-65a56d0e-20241020",
    "react-hook-form": "^7.54.0",
    "sharp": "0.32.6",
    "swiper": "^11.1.15"
  },
  "devDependencies": {
    "@types/node": "^22.5.4",
    "@types/react": "npm:[email protected]",
    "@types/react-dom": "npm:[email protected]",
    "eslint": "^8",
    "eslint-config-next": "15.0.0",
    "sass": "^1.81.0",
    "typescript": "5.7.2"
  },
  "engines": {
    "node": "^18.20.2 || >=20.9.0"
  },
  "pnpm": {
    "overrides": {
      "@types/react": "npm:[email protected]",
      "@types/react-dom": "npm:[email protected]"
    }
  },
  "overrides": {
    "@types/react": "npm:[email protected]",
    "@types/react-dom": "npm:[email protected]"
  }
}

AgrrFoss avatar Dec 14 '24 13:12 AgrrFoss

Walkthrough

The pull request introduces a "Forgot password?" feature to the Login component across multiple authentication-related pages. The changes primarily involve updating import paths to use more consistent relative imports and adding a navigation mechanism to a new password reset route. The modifications maintain the existing component structure while introducing a new user interface element for password recovery.

Changes

File Change Summary
Client/src/Pages/Auth/Login/Login.jsx - Updated import paths to use ../../../
- Added "Forgot password?" link
- Implemented handleNavigate function for password reset navigation

Sequence Diagram

sequenceDiagram
    participant User
    participant LoginComponent
    participant Router
    
    User->>LoginComponent: Clicks "Reset password"
    LoginComponent->>Router: Navigate to "/forgot-password"
    Router-->>User: Redirect to Forgot Password Page

The sequence diagram illustrates the simple navigation flow when a user clicks on the newly added "Reset password" link, which triggers a route change to the forgot password page.

[!TIP] CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Dec 15 '24 18:12 coderabbitai[bot]

Can you please send a screenshot showing those pages?

gorkem-bwl avatar Dec 15 '24 19:12 gorkem-bwl

Sure

image

image

aroy114 avatar Dec 15 '24 19:12 aroy114

Sure

Great, thanks. I believe the light theme looks ok on your end, right? Can you check that too?

For my info - there should have been a PR template when you issue this PR. Did you see it? I am not sure if that is in action.

It should have looked something like this:

image

gorkem-bwl avatar Dec 15 '24 19:12 gorkem-bwl

Great, thanks. I believe the light theme looks ok on your end, right? Can you check that too?

Yes, the light theme is also fine.

image

image

aroy114 avatar Dec 15 '24 20:12 aroy114

For my info - there should have been a PR template when you issue this PR. Did you see it? I am not sure if that is in action.

Ok, I'll add it

aroy114 avatar Dec 15 '24 20:12 aroy114

For my info - there should have been a PR template when you issue this PR. Did you see it? I am not sure if that is in action.

Ok, I'll add it

OK. It's important you do not remove it next time. It's meant to be filled in properly.

gorkem-bwl avatar Dec 15 '24 20:12 gorkem-bwl

OK. It's important you do not remove it next time. It's meant to be filled in properly.

I have added it. Please check.

aroy114 avatar Dec 15 '24 20:12 aroy114

It looks like you've just copied your Login.jsx and pasted it over the most recent version of /Auth/Login/Login.jsx.

That will overwrrite all the changes made in recent PRs.

I'm going to close this PR as this is not mergeable, if you'd like to commit the code for adding the reset password link the steps to follow are

  1. Checkout develop remote branch
  2. Create a new branch from the current state of develop
  3. Make your changes, commit, and push.

ajhollid avatar Dec 17 '24 01:12 ajhollid

Hi @ajhollid, I pulled the changes from the develop branch and I could find the /Auth/Login/Login.jsx file. But when I make changes to this file or the files inside the /Auth/Login/Component, I can't see any changes being reflected to the frontend.

Also I can still see the previous login.jsx file outside the Login folder and when I make changes to this file then I can see the changes getting reflected on the frontend too. Is this supposed to happen?

aroy114 avatar Dec 17 '24 18:12 aroy114

@Anand-Royy I can't really troubleshoot your repository for you remotely, my suggestion to quickly get back on track is just reclone the repository.

Any other Git troubleshooting you'll have to handle on your end.

ajhollid avatar Dec 17 '24 18:12 ajhollid

A recent PR has moved the Login.jsx file to /Auth/Login/Login.jsx, the /Auth/Login.jsx page no longer exists.

@ajhollid I can see both the files in the repo

image

aroy114 avatar Dec 17 '24 18:12 aroy114

@Anand-Royy if it's still hanging around it should be removed.

I'll remove it in a future PR

ajhollid avatar Dec 17 '24 18:12 ajhollid

@ajhollid Yes, so the changes made to the file /Auth/Login.jsx is actually reflecting to the frontend and not the file changes made in /Auth/Login/Login.jsx. Please check this because my local repo is updated with the latest commit in the remote branch and I can observe these changes.

aroy114 avatar Dec 17 '24 18:12 aroy114

Hi @Anand-Royy ,

You are correct, the old page was being rendered by the router. I have removed the old page and corrected the route, you can make a new PR with your changes in the /Auth/Login/Login.jsx page if you'd like.

Thanks!

ajhollid avatar Dec 17 '24 21:12 ajhollid