craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

[4.x]: Frontend Site broke after performing a feed with feed me #13634

Closed adamFernandez closed 1 year ago

adamFernandez commented 1 year ago

On our last data migration from wordpress i import through feed me all the data but the postDates.

31-08-2023 11:12 I imported a csv file in feed me with all the posts content including the postDates which it was successful.

I tried first on our staging environment and everything worked fine. So I went to production and I noticed, in this version, feed me was not installed. So I installed it back, following on dashboard instructions steps. Performed the import with feed me (updating just the postDates) for every post (blog section) realising the frontend site went to the Server error page image We were getting an undefined entry error on the frontend. Which it didn't make sense as it was working till the feed, or the composer update, or the db update. We have a Craft 4, Nuxt 2 (^2.15.8) app running.

We were getting a Graphql error on the console: “errors”: [ { “message”: “Something went wrong when processing the GraphQL query.” } ] } Screenshot 2023-08-31 at 16 28 06

That fragment was appearing everywhere and throwing an error.

yarn packages: "dependencies": { "@nuxtjs/axios": "^5.13.6", "@nuxtjs/gtm": "^2.4.0", "@nuxtjs/pwa": "^3.3.5", "@nuxtjs/robots": "^2.5.0", "@nuxtjs/sitemap": "^2.4.0", "axios": "^0.21.1", "core-js": "^3.19.3", "fake-tag": "^2.0.0", "graphql": "^15.4.0", "gsap": "npm:@gsap/member", "lodash.debounce": "^4.0.8", "nuxt": "^2.15.8", "nuxt-intercom": "^1.1.1", "vue": "^2.6.14", "vue-horizontal": "^0.8.12", "vue-server-renderer": "^2.6.14", "vue-template-compiler": "^2.6.14", "webpack": "^4.46.0" }, "devDependencies": { "@babel/eslint-parser": "^7.16.3", "@graphql-codegen/cli": "^1.21.7", "@graphql-codegen/fragment-matcher": "^2.0.1", "@graphql-codegen/introspection": "^1.18.2", "@nuxt/image": "^0.7.1", "@nuxtjs/eslint-config": "^8.0.0", "@nuxtjs/eslint-module": "^3.0.2", "dashjs": "^4.7.0", "eslint": "^8.4.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-nuxt": "^3.1.0", "eslint-plugin-vue": "^8.2.0", "graphql-cli": "4.1.0", "prettier": "^2.5.1", "sass": "^1.55.0", "sass-loader": "10", "vue-observe-visibility": "^1.0.0" }

After a few hours, we got it fixed by moving the inline graphql fragments from the top of the query to the bottom :

export const containerQuery = gql ${entryBlocks} (from here) ${parent} (from here) query containerQuery($slug: [String], $level: Int, $id: [QueryArgument]) { entry(section: "pageContainer", slug: $slug, level: $level, id: $id) { level slug id title typeHandle ...parent ...entryBlocks children { ... (to here)

We managed to fix it, but it would be nice to know what exactly happened.

Here are the php error logs for that day:

10:33(1) - 11:22 (10) - 14:08 (2) > 13 instances of this one: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘guestxm_production.sites’ doesn’t exist in /home/forge/craft.guestxm.com/cms/vendor/yiisoft/yii2/db/Command.php:1302 ReflectionException: Class “yii\web\JsonResponseFormatter” does not exist Error: Class “yii\di\NotInstantiableException” not found in /home/forge/craft.guestxm.com/cms/vendor/yiisoft/yii2/di/Container.php:509 14:18 (9) > craft\errors\SiteNotFoundException: No sites exist in /home/forge/craft.guestxm.com/cms/vendor/craftcms/cms/src/web/Request.php:1469

If you need the full detailed version of any of the logs please let me know

Some help will be appreciated.

Craft CMS version

4.5.3

PHP version

8.1.5

Operating system and version

Mac Ventura 13.1 (22C65)

Database type and version

mysql 8.0.21

Image driver and version

No response

Installed plugins and versions

"craftcms/aws-s3": "2.0.3", "craftcms/cms": "^4.0.0-beta.4", "craftcms/feed-me": "5.2.0", "craftcms/redactor": "3.0.4", "nystudio107/craft-autocomplete": "^1.0.0", "nystudio107/craft-imageoptimize": "4.0.5", "nystudio107/craft-retour": "4.1.12", "nystudio107/craft-seomatic": "4.0.28", "verbb/formie": "2.0.32", "vlucas/phpdotenv": "^5.4.0", "yiisoft/yii2-redis": "^2.0.6"

i-just commented 1 year ago

Hi, thanks for getting in touch!

We were getting an undefined entry error on the frontend. Which it didn't make sense as it was working till the feed, or the composer update, or the db update. We have a Craft 4, Nuxt 2 (^2.15.8) app running.

We were getting a Graphql error on the console: “errors”: [ { “message”: “Something went wrong when processing the GraphQL query.” } ] }

After a few hours, we got it fixed by moving the inline graphql fragments from the top of the query to the bottom

It sounds like it was caused by updating to version 4.5+ and related to this issue: https://github.com/craftcms/cms/issues/13622, which is now fixed for the next release.

Hope this helps! I’m going to go ahead and close this one, but please don’t hesitate to get in touch if you run into any further issues.