Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when clicking on any sort of dropdown/select: TypeError: g.indexOf is not a function & react-error-boundary requires either a fallback #14993

Closed
alainkaiser opened this issue Nov 24, 2022 · 31 comments
Assignees
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: core:content-manager Source is core/content-manager package status: pending reproduction Waiting for free time to reproduce the issue, or more information

Comments

@alainkaiser
Copy link

Bug report

I just deployed my strapi application to production via DigitalOcean (app-plattform). The entire process worked without any bigger issues and the app runs in production. As I now started to work on content, I just noticed a strange bug/behavior. Whenever I click on any of the select/dropdown components in the Content Manager like the "Filters" dropdown or the "language" dropdown inside the content-table, I am getting a white blank page and some strange errors in the browser console (screenshots).

This behavior happens only on the deployed version of strapi (PROD node env). Locally, everything is working fine and with no issues.

Required System information

  • Node.js version: >=14.19.1 <=18.x.x
  • NPM version: >=6.0.0
  • Strapi version: 4.5.2
  • Database: pg/ postgresql dev database from DigitalOcean
  • Operating system: Mac

Describe the bug

I just deployed my strapi application to production via DigitalOcean (app-plattform). The entire process worked without any bigger issues and the app runs in production. As I now started to work on content, I just noticed a strange bug/behavior. Whenever I click on any of the select/dropdown components in the Content Manager like the "Filters" dropdown or the "language" dropdown inside the content-table, I am getting a white blank page and some strange errors in the browser console (screenshots).

This behavior happens only on the deployed version of strapi (PROD node env). Locally, everything is working fine and with no issues.

Steps to reproduce the behavior

  1. Go to: "Content Manager"
  2. Click on: "Any dropdown or select component"
  3. The blank white page and some error logs in the browser are appearing

Expected behavior

The expected behavior is that all the dropdown and select components should work fine. I as a content-admin should be able to set filters, change the language etc.

Screenshots

Click on the "Content available in" dropdown:
The bug occures not only when clicking on this dropdown. The bug also occures when clicking on the "Filters" button, the "Pagination (Entries per page)" dropdown, the "x currently selected" dropdown etc.
image

Blank white page with errors appearing:
image

Code snippets

Browser error messages:

main.59c5fc55.js:37 TypeError: g.indexOf is not a function
    at Ia (1353.e7c23741.chunk.js:1:503)
    at V (main.59c5fc55.js:669:23352)
    at main.59c5fc55.js:5:23747
    at Object.k [as current] (main.59c5fc55.js:669:23145)
    at main.59c5fc55.js:5:24121
    at main.59c5fc55.js:5:24213
    at main.59c5fc55.js:1401:488
    at Rl (main.59c5fc55.js:37:1446)
    at Xc (main.59c5fc55.js:39:5398)
    at t.unstable_runWithPriority (main.59c5fc55.js:60:3817)
xl @ main.59c5fc55.js:37
main.59c5fc55.js:37 Error: react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop
    at h.render (1353.e7c23741.chunk.js:91:7286)
    at wl (main.59c5fc55.js:35:67554)
    at mc (main.59c5fc55.js:35:67342)
    at lr (main.59c5fc55.js:39:10195)
    at Qc (main.59c5fc55.js:39:990)
    at id (main.59c5fc55.js:39:918)
    at pl (main.59c5fc55.js:39:770)
    at Ul (main.59c5fc55.js:37:11052)
    at main.59c5fc55.js:35:39426
    at t.unstable_runWithPriority (main.59c5fc55.js:60:3817)
xl @ main.59c5fc55.js:37
main.59c5fc55.js:35 Uncaught Error: react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop
    at h.render (1353.e7c23741.chunk.js:91:7286)
    at wl (main.59c5fc55.js:35:67554)
    at mc (main.59c5fc55.js:35:67342)
    at lr (main.59c5fc55.js:39:10195)
    at Qc (main.59c5fc55.js:39:990)
    at id (main.59c5fc55.js:39:918)
    at pl (main.59c5fc55.js:39:770)
    at Ul (main.59c5fc55.js:37:11052)
    at main.59c5fc55.js:35:39426
    at t.unstable_runWithPriority (main.59c5fc55.js:60:3817)

Additional context

Thanks in advance for your help!

@alainkaiser
Copy link
Author

I just found some sort of the same bug pattern here. FYI:
#14981

@bsanuk
Copy link

bsanuk commented Nov 25, 2022

I'm having the same problem both on Prod and locally.

@alainkaiser
Copy link
Author

Hi all, I just did some more testing and debugging. As described in the bug report, I used the newest version v4.5.2. After downgrading to v4.5.0 the error is gone and all works good.

So there must be an issue with v4.5.1 or v4.5.2 I think...

@bsanuk
Copy link

bsanuk commented Nov 25, 2022

Downgrading to 4.5.1 worked for me.

@jb-thery
Copy link

jb-thery commented Nov 26, 2022

I confirm that error occur in production (not dev) when I click on paginations button's


  "@strapi/plugin-documentation": "^4.5.2",
    "@strapi/plugin-graphql": "^4.5.2",
    "@strapi/plugin-i18n": "4.5.2",
    "@strapi/plugin-users-permissions": "4.5.2",
    "@strapi/provider-upload-cloudinary": "^4.5.2",
    "@strapi/strapi": "4.5.2",
react_devtools_backend.js:4026 TypeError: g.indexOf is not a function
    at Ia (6593.8ace1a41.chunk.js:1:503)
    at G (main.dbb2580d.js:693:22576)
    at main.dbb2580d.js:5:23934
    at Object.Q [as current] (main.dbb2580d.js:693:22369)
    at main.dbb2580d.js:5:24308
    at main.dbb2580d.js:5:24400
    at main.dbb2580d.js:1425:489
    at xl (main.dbb2580d.js:632:1446)
    at Xc (main.dbb2580d.js:634:5398)
    at t.unstable_runWithPriority (main.dbb2580d.js:662:3818)
overrideMethod @ react_devtools_backend.js:4026
Sl @ main.dbb2580d.js:632
x.payload @ main.dbb2580d.js:632
ro @ main.dbb2580d.js:630
mc @ main.dbb2580d.js:630
nr @ main.dbb2580d.js:634
kc @ main.dbb2580d.js:634
id @ main.dbb2580d.js:634
sl @ main.dbb2580d.js:634
jl @ main.dbb2580d.js:632
(anonymous) @ main.dbb2580d.js:630
t.unstable_runWithPriority @ main.dbb2580d.js:662
Uu @ main.dbb2580d.js:630
Jl @ main.dbb2580d.js:630
To @ main.dbb2580d.js:630
Ft @ main.dbb2580d.js:634
Hn @ main.dbb2580d.js:630
react_devtools_backend.js:4026 Error: react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop
    at h.render (6593.8ace1a41.chunk.js:84:7285)
    at Dl (main.dbb2580d.js:630:67549)
    at mc (main.dbb2580d.js:630:67337)
    at nr (main.dbb2580d.js:634:10195)
    at kc (main.dbb2580d.js:634:990)
    at id (main.dbb2580d.js:634:918)
    at sl (main.dbb2580d.js:634:770)
    at jl (main.dbb2580d.js:632:11052)
    at main.dbb2580d.js:630:39426
    at t.unstable_runWithPriority (main.dbb2580d.js:662:3818)
overrideMethod @ react_devtools_backend.js:4026
Sl @ main.dbb2580d.js:632
x.callback @ main.dbb2580d.js:632
ss @ main.dbb2580d.js:630
xl @ main.dbb2580d.js:632
Xc @ main.dbb2580d.js:634
t.unstable_runWithPriority @ main.dbb2580d.js:662
Uu @ main.dbb2580d.js:630
Xu @ main.dbb2580d.js:634
jl @ main.dbb2580d.js:632
(anonymous) @ main.dbb2580d.js:630
t.unstable_runWithPriority @ main.dbb2580d.js:662
Uu @ main.dbb2580d.js:630
Jl @ main.dbb2580d.js:630
To @ main.dbb2580d.js:630
Ft @ main.dbb2580d.js:634
Hn @ main.dbb2580d.js:630
main.dbb2580d.js:630 Uncaught Error: react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop
    at h.render (6593.8ace1a41.chunk.js:84:7285)
    at Dl (main.dbb2580d.js:630:67549)
    at mc (main.dbb2580d.js:630:67337)
    at nr (main.dbb2580d.js:634:10195)
    at kc (main.dbb2580d.js:634:990)
    at id (main.dbb2580d.js:634:918)
    at sl (main.dbb2580d.js:634:770)
    at jl (main.dbb2580d.js:632:11052)
    at main.dbb2580d.js:630:39426
    at t.unstable_runWithPriority (main.dbb2580d.js:662:3818)

Downgrading to 4.5.1 worked for me.

@valebedu
Copy link

I'm facing the exact same problem, but in my case downgrading didn't work.

In my case, I am using a generic article component in many content types (articleA, articleB, articleC for example).

The article component has multiple fields with "one-to-one" and "one-to-many" relationships.

Each type of article (articleA, articleB, articleC) has several specific fields and has in common the article component. This component is single and required.

With Strapi 4.5.0, 4.5.1 and 4.5.2, when creating an entry for articleA and filling in the values in the component, I had a white screen with a similar stack trace when I click on a "one-to-many" relationship field.

By changing the component property from required to optional, I was able to edit any "one-to-many" relationship field in the component.

This is an acceptable workaround for our team at this time.

@landoephan
Copy link

I'm facing the same issue. A downgrade helped. However, with strapi 4.5.1 and the versioning plugin https://github.com/notum-cz/strapi-plugin-content-versioning I sometimes get the behaviour that when I switch the language, instead of showing me the entry in the other language, it gives me the option to create a new entry.

That always happens, when I switch from an "unmatched" version, so e.g. I have v1 and v2 for an entry in english and only v1 for the same entry in french. Now when I selected v2 in english and switch to french, instead of showing me the entry v1 in french, strapi wants to create a new entry (which when I create the entry results in a whole new entry in english, not even a new version in french). I'm not sure if these issues are related.

@iyansr
Copy link

iyansr commented Nov 29, 2022

same here, but im using 4.5.1

@morwalz
Copy link

morwalz commented Nov 30, 2022

Any news on this issue? I am having the same problem. Do not want to go downwards.

@iyansr
Copy link

iyansr commented Nov 30, 2022

same here, but im using 4.5.1

upgrading to 4.5.2 fix the issue

so weird 😅

@fabio-nettis
Copy link

Update

Still seeing this error in version 4.5.3. As I have seen, as mentioned in #15031 you have provided a working error boundary to stop the component tree from desintegrating prematurely. The issue still persists tho.

screenshot-error-boundary

Following output is logged:

screenshot-error-console

@Gupramallo
Copy link

I'm also having the same issue when trying to change the position of a component with relations in a Dynamic Zone. Had to downgrade to 4.4.7 to make it work

@limichange
Copy link

The same error occurs when switching locals in v4.5.3.

@joshuaellis
Copy link
Member

I've been unable to reproduce this locally. If someone can share a minimal viable reproduction of the issue that would help us to actively debug this and find a solution 😄 see this for more information on how you can approach it.

@landoephan
Copy link

I'm trying to build a fresh project that reproduces this error, but I can't so far. When I update all dependencies in my current project, I'm receiving the error though. I'll run some more tries to reproduce the issue on a fresh project.

@joshuaellis
Copy link
Member

Thanks @landoephan 😄

@landoephan
Copy link

got it! you need to add the "import-export-entries"-plugin (https://github.com/Baboo7/strapi-plugin-import-export-entries) and activate both.
So with this config/plugins.ts content I get the error:

export default ({ env }) => ({
  i18n: true,
  // see https://github.com/Baboo7/strapi-plugin-import-export-entries for configurations
  'import-export-entries': {
    enabled: true,
  },
});

with these two configs everything works fine:

export default ({ env }) => ({
  i18n: true,
  // see https://github.com/Baboo7/strapi-plugin-import-export-entries for configurations
  'import-export-entries': {
    enabled: false,
  },
});
export default ({ env }) => ({
  i18n: false,
  // see https://github.com/Baboo7/strapi-plugin-import-export-entries for configurations
  'import-export-entries': {
    enabled: true,
  },
});

@joshuaellis joshuaellis added issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: core:content-manager Source is core/content-manager package status: pending reproduction Waiting for free time to reproduce the issue, or more information labels Dec 2, 2022
@landoephan
Copy link

do you still need a repo?

@landoephan
Copy link

https://github.com/landoephan/strapi-language-switcher-bug

@landoephan
Copy link

I'm getting an error when I open dropdowns and a white page when I switch tabs from "Content Manager" to Content-Type Builder"

@joshuaellis
Copy link
Member

Thanks for the information & repro @landoephan, we'll try find some time and review this issues to get it solved as fast as we can.

@landoephan
Copy link

thanks!

@joshuaellis
Copy link
Member

Hi everyone, I've had some time to look into this error via the repro shared by @landoephan, I haven't been able to reproduce this exact error. I did face this:

TypeError: Cannot convert undefined or null to object
    at hasOwnProperty (<anonymous>)

But found deleting the yarn.lock worked, it looks like an upstream dependency had a custom polyfill that interfered with our minifier, but like I said, removing yarn.lock worked in resolving that issue, this left no visible issues. I'd advise everyone to do the same and see if the error persists.

If it does, you will need to provide a reproduction of this issue for us to investigate further.

@landoephan
Copy link

seems to work, thank you!

@joshuaellis
Copy link
Member

We haven't been able to reproduce this error and no one has been able to provide an minimal repro of the error occurring so I'm going to close this for now & if someone can provide a reproduction then we can reopen and revisit the issue.

Before you do that, I would encourage you to try this resolution first – #14993 (comment)

@joshuaellis joshuaellis closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2022
@fabio-nettis
Copy link

@joshuaellis Has been fixed for me in version 4.5.4.

@rktyt
Copy link

rktyt commented Dec 28, 2022

The same error occurs when switching locals in v4.5.4.
This did not occur in v4.5.3.

I am using typescript.

The problem occurs with the command npx strapi build && npx strapi start.
The problem does not occur with the command npx strapi build --no-optimization && npx strapi start.

  "dependencies": {
    "@strapi/plugin-i18n": "4.5.4",
    "@strapi/plugin-users-permissions": "4.5.4",
    "@strapi/provider-email-nodemailer": "4.5.4",
    "@strapi/provider-upload-aws-s3-custom": "file:providers/strapi-provider-upload-aws-s3-custom",
    "@strapi/strapi": "4.5.4",
    "mysql": "^2.18.1"
  }

providers/strapi-provider-upload-aws-s3-custom/package.json

  "dependencies": {
    "@aws-sdk/client-s3": "3.226.0",
    "@aws-sdk/lib-storage": "3.226.0",
    "@aws-sdk/signature-v4-crt": "3.226.0"
  }

and my plugin's package.json

  "dependencies": {
    "@aws-sdk/client-s3": "3.226.0",
    "@aws-sdk/lib-storage": "3.226.0",
    "@aws-sdk/signature-v4-crt": "3.226.0",
    "@monaco-editor/react": "^4.4.6",
    "csv-parse": "^5.3.3",
    "csv-stringify": "^6.2.3",
    "html-validate": "^7.11.1",
    "jszip": "^3.10.1",
    "monaco-editor": "^0.34.1"
  }

Notes:

  • In v4.5.3, html-validate was v7.10.1. However, html-validate is considered irrelevant for server-side use.
  • Using npm@8

@derrickmehaffy
Copy link
Member

I'll reopen this but can you provide more in-depth instructions to reproduce the issue? Maybe record a loom video?

@rktyt
Copy link

rktyt commented Jan 5, 2023

@derrickmehaffy

Sorry, wrong information.
I looked back at the code and found that html-validate was also used on the browser.
So in my case it seems to be due to the html-validate update.


https://github.com/strapi/strapi/blob/v4.5.4/packages/core/admin/webpack.config.js#L72-L78
Looking at the code above, it seems to be a problem with esbuild or esbuild-loader.

In my case, I don't need to support older browsers, so if I want to reduce the file size, changing the target option to es2018 or higher will work.

@joshuaellis
Copy link
Member

@derrickmehaffy I think we can close this again in this circumstance. We're not in a position to update the target right now (although we have raised it to implement a browserlist spec previously).

@derrickmehaffy
Copy link
Member

Gotcha will do

@derrickmehaffy derrickmehaffy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug Issue reporting a bug severity: high If it breaks the basic use of the product source: core:content-manager Source is core/content-manager package status: pending reproduction Waiting for free time to reproduce the issue, or more information
Projects
Status: Fixed/Shipped
Archived in project
Development

No branches or pull requests