strapi / strapi

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.
https://strapi.io
Other
63.49k stars 8.06k forks source link

"NEXUS__UNKNOWN__TYPE was already defined and imported as a type" #19163

Closed mikeyfe6 closed 9 months ago

mikeyfe6 commented 9 months ago

Bug report

Required System information

Environment: development OS: darwin-x64 Strapi Version: 4.16.2 Node/Yarn Version: yarn/1.22.21 npm/10.25.0 node/v20.10.0 darwin x64 Edition: Community Database: sqlite Project: Javascript

Describe the bug

after updating all my packages, i'm getting this error in my Strapi procuction app, trying to open it says this below..

heroku logs --tail shows this:

State changed from crashed to starting
2024-01-07T13:55:13.178431+00:00 heroku[web.1]: Starting process with command `npm start`
2024-01-07T13:55:14.739622+00:00 app[web.1]:
2024-01-07T13:55:14.739666+00:00 app[web.1]: > ads-backend@0.1.0 start
2024-01-07T13:55:14.739667+00:00 app[web.1]: > strapi start
2024-01-07T13:55:14.739667+00:00 app[web.1]:
2024-01-07T13:55:17.519188+00:00 app[web.1]: [2024-01-07 13:55:17.517] warn: Users-permissions registration has defaulted to accepting the following additional user fields during registration: gebruiker,website
2024-01-07T13:55:17.639475+00:00 app[web.1]: [2024-01-07 13:55:17.639] debug: ⛔️ Server wasn't able to start properly.
2024-01-07T13:55:17.639790+00:00 app[web.1]: [2024-01-07 13:55:17.639] error: NEXUS__UNKNOWN__TYPE was already defined and imported as a type, check the docs for extending types
2024-01-07T13:55:17.639791+00:00 app[web.1]: Error: NEXUS__UNKNOWN__TYPE was already defined and imported as a type, check the docs for extending types
2024-01-07T13:55:17.639792+00:00 app[web.1]: at extendError (/app/node_modules/nexus/dist/builder.js:1123:12)
2024-01-07T13:55:17.639792+00:00 app[web.1]: at SchemaBuilder.addType (/app/node_modules/nexus/dist/builder.js:156:27)
2024-01-07T13:55:17.639793+00:00 app[web.1]: at SchemaBuilder.missingType (/app/node_modules/nexus/dist/builder.js:704:14)
2024-01-07T13:55:17.639793+00:00 app[web.1]: at SchemaBuilder.getOrBuildType (/app/node_modules/nexus/dist/builder.js:938:21)
2024-01-07T13:55:17.639793+00:00 app[web.1]: at SchemaBuilder.getInputType (/app/node_modules/nexus/dist/builder.js:868:34)
2024-01-07T13:55:17.639794+00:00 app[web.1]: at SchemaBuilder.buildInputObjectField (/app/node_modules/nexus/dist/builder.js:828:60)
2024-01-07T13:55:17.639794+00:00 app[web.1]: at /app/node_modules/nexus/dist/builder.js:777:41
2024-01-07T13:55:17.639795+00:00 app[web.1]: at Array.forEach (<anonymous>)
2024-01-07T13:55:17.639796+00:00 app[web.1]: at SchemaBuilder.buildInputObjectFields (/app/node_modules/nexus/dist/builder.js:776:16)
2024-01-07T13:55:17.639796+00:00 app[web.1]: at fields (/app/node_modules/nexus/dist/builder.js:504:32)
2024-01-07T13:55:17.658582+00:00 app[web.1]: npm notice
2024-01-07T13:55:17.658727+00:00 app[web.1]: npm notice New major version of npm available! 9.6.3 -> 10.2.5
2024-01-07T13:55:17.658795+00:00 app[web.1]: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>
2024-01-07T13:55:17.658896+00:00 app[web.1]: npm notice Run `npm install -g npm@10.2.5` to update!
2024-01-07T13:55:17.658948+00:00 app[web.1]: npm notice
2024-01-07T13:55:17.739188+00:00 heroku[web.1]: Process exited with status 1
2024-01-07T13:55:17.764509+00:00 heroku[web.1]: State changed from starting to crashed
2024-01-07T13:55:21.074321+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=afrodiasphere-backend.herokuapp.com request_id=892f6d54-8647-4e9b-87b0-7da3dfdadd6f fwd="95.96.75.131" dyno= connect= service= status=503 bytes= protocol=https
2024-01-07T13:55:21.898814+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=afrodiasphere-backend.herokuapp.com request_id=807c4daa-0832-4b3d-ab62-49fb16375285 fwd="95.96.75.131" dyno= connect= service= status=503 bytes= protocol=https

Steps to reproduce the behavior

Deploying in Heroku, that goes fine. But when i'm trying to open the app, i'm getting..

image

Expected behavior

I expect to go into my production admin panel without issues

Screenshots

error in terminal:

Scherm­afbeelding 2024-01-07 om 15 10 07

build log heroku:

-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected

-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true

-----> Installing binaries
       engines.node (package.json):  19.9.0
       engines.npm (package.json):   9.6.3

       Resolving node version 19.9.0...
       Downloading and installing node 19.9.0...
       npm 9.6.3 already installed with node

-----> Restoring cache
       - node_modules

-----> Installing dependencies
       Installing node modules (package.json)

       up to date, audited 1430 packages in 9s

       173 packages are looking for funding
         run `npm fund` for details

       19 vulnerabilities (6 moderate, 13 high)

       To address all issues possible (including breaking changes), run:
         npm audit fix --force

       Some issues need review, and may require choosing
       a different dependency.

       Run `npm audit` for details.
       npm notice 
       npm notice New major version of npm available! 9.6.3 -> 10.2.5
       npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>
       npm notice Run `npm install -g npm@10.2.5` to update!
       npm notice 

-----> Build
       Running build

       > ads-backend@0.1.0 build
       > strapi build

- Building build context

       [INFO] Including the following ENV variables as part of the JS bundle:
           - ADMIN_PATH
           - STRAPI_ADMIN_BACKEND_URL
           - STRAPI_TELEMETRY_DISABLED
✔ Building build context (156ms)
- Building admin panel

✔ Building admin panel (17161ms)

-----> Caching build
       - node_modules

-----> Pruning devDependencies

       up to date, audited 1430 packages in 4s

       173 packages are looking for funding
         run `npm fund` for details

       19 vulnerabilities (6 moderate, 13 high)

       To address all issues possible (including breaking changes), run:
         npm audit fix --force

       Some issues need review, and may require choosing
       a different dependency.

       Run `npm audit` for details.

-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 151.8M
-----> Launching...
       Released v82
       https://afrodiasphere-backend.herokuapp.com/ deployed to Heroku

package.json:

Scherm­afbeelding 2024-01-07 om 15 25 16
mikeyfe6 commented 9 months ago

solved it by using YARN in production!

amityweb commented 2 months ago

I receive this same error after installing a caching extension to try, which did not work, so I uninstalled it, then get this issue. Not much help online at all for this, it's crazy.

Using Yarn did indeed make this work for me, although I am still concerned of some underlying issue in the code somewhere. The only reference to NEXUSUNKNOWNTYPE is in the Strapi nexus extension utils.js file.