Closed cjboco closed 1 year ago
Okay, so I added console.log(' --debug', apis[ct].contentTypes);
at line 26 of your register.js. This is right above your const uid = apis[ct].contentTypes[ct].uid;
call.
Here's the result:
--debug {
global: {
kind: 'singleType',
collectionName: 'globals',
info: {
singularName: 'global',
pluralName: 'globals',
displayName: 'Global',
description: ''
},
options: { draftAndPublish: true },
pluginOptions: { i18n: [Object] },
attributes: {
navigation: [Object],
footer: [Object],
createdAt: [Object],
updatedAt: [Object],
publishedAt: [Object],
createdBy: [Object],
updatedBy: [Object]
},
__schema__: {
collectionName: 'globals',
info: [Object],
options: [Object],
pluginOptions: [Object],
attributes: [Object],
kind: 'singleType'
},
modelType: 'contentType',
modelName: 'global',
connection: 'default',
uid: 'api::global.global',
apiName: 'global',
globalId: 'Global',
actions: {},
lifecycles: {}
}
}
--debug {}
As you can see, there is nothing in the last '--debug' call. It's an empty object, so no 'uid' exists.
Please let me know how I can help you debug this further, as I don't understand this plugin structure that well.
From the Strapi team here, could you possibly share your entire codebase?
I edited line 21 from
if (!Object.hasOwnProperty.call(apis, ct)) {
to
if (!Object.hasOwnProperty.call(apis, ct) || !apis[ct].contentTypes.hasOwnProperty('uid')) {
and Strapi starts now.
(generally speaking, it's not possible for a content-type to not have a UID, we build them during the register phase)
From the Strapi team here, could you possibly share your entire codebase?
It's a private repo, not 100% sure my client would be down with that, but let me see what I can do.
From the Strapi team here, could you possibly share your entire codebase?
It's a private repo, not 100% sure my client would be down with that, but let me see what I can do.
If you need to you can add me to the repo instead, if you need to verify I work for Strapi you can email me at derrick.mehaffy@strapi.io
From the Strapi team here, could you possibly share your entire codebase?
It's a private repo, not 100% sure my client would be down with that, but let me see what I can do.
If you need to you can add me to the repo instead, if you need to verify I work for Strapi you can email me at derrick.mehaffy@strapi.io
You have access
From the Strapi team here, could you possibly share your entire codebase?
It's a private repo, not 100% sure my client would be down with that, but let me see what I can do.
If you need to you can add me to the repo instead, if you need to verify I work for Strapi you can email me at derrick.mehaffy@strapi.io
You have access
not seeing the inv, is this on github?
Hmmm still not seeing it :thinking:
There we go, got it :)
Your home-page
folder in ./src/api
is empty, that's your problem, you need to delete the home-page
folder
(it's missing the schema.json file inside of the content-type folder)
I never said I was a smart! :-)
happens to everyone, honestly this is something we should catch and warn about. Welcome to the Strapi ecosystem though :)
Let us know if that fixes the issue though :wink:
I wonder if you can throw an error on that... something like you have a empty api end-point or something. I don't think I ever would have caught that one.
Thank you!
Yeah we can do it easily, it should be wrapped in a try/catch and just dump the error and still allow the app to load without that content-type
Just to confirm, I removed the directory and also reverted the register.js file and it has started perfectly!
[Edit] Deployed to DO with no issues. Thanks again @derrickmehaffy!
Thanks @derrickmehaffy !
|| !apis[ct].contentTypes.hasOwnProperty('uid')
Can we add this into the source ? seems if we have custom controllers this also breaks the compile, and since custom controllers dont have a schema.json it fails and we cant use this plugin.
After installing your plugin, I was trying to deploy on Digital Ocean, I kept getting a build failure. Saw an error and then tried starting Strapi locally and got same error:
Using Strapi v4.6.1 - Node v16.19.1 - NPM v8.6.3
[EDIT] I added a console.log at line 26 of your register.js file and it looks like UID is not available on one of my collection types:
[Edit2] It is there, sorry. I'll research a little more before posting more info.