Open netzpixel opened 3 months ago
I am also facing the same exact error on my strapi build
Thanks for reporting the issue you are having with. Can you provide me the exact strapi version you are having the issue with? I will take a look at it within the next couple of day.
@netzpixel I just found some time to investigate into the issue you are having. When using the latest strapi 4.24.3
, I have encountered an issue with the automatic generation of the content types. Please report me if the following fixes your issue:
1.2.4
./src/api/cookie/
./src/api/cookie-category/
./src/api/cookie-popup/
yarn develop
or npm develop
./src/api/cookie/services/cookie.js
./src/api/cookie-category/services/cookie-category.js
@netzpixel I just found some time to investigate into the issue you are having. When using the latest strapi
4.24.3
, I have encountered an issue with the automatic generation of the content types. Please report me if the following fixes your issue:1. Upgrade the plugin to version `1.2.4` 2. Delete the following content types folders which were generated by the plugin: `./src/api/cookie/` `./src/api/cookie-category/` `./src/api/cookie-popup/` 3. Run strapi with `yarn develop` or `npm develop` 4. Make the changes according to the documentation inside of: `./src/api/cookie/services/cookie.js` `./src/api/cookie-category/services/cookie-category.js` 5. Now it should work
This didn't worked for me
@netzpixel Alright, I managed to reproduce the issue when using strapi with typescript. It seems to be a bug with a strapi function which is called by the plugin when generating the content types. Unfortunately, I can't fix it in the plugin right now. But I can help you fixing it manually. Here's how you do it:
draftAndPublish
has the value false
inside of
./src/api/cookie-popup/content-types/cookie-popup/schema.json
routes
& services
folder from for example ./src/api/cookie-category
into ./src/api/cookie-popup/
. Then rename these files and the names inside the code accordingly from cookie-category
to cookie-popup
.yarn strapi ts:generate-types
yarn develop
Worked for me thanks
After a fresh install I get 3 errors right away. I tried changing the two files:
No clue what to change that it works. I'm on the latest version of strapi.
2024-05-26 22:04:20 WARNING in ../node_modules/strapi-plugin-cookie-manager/admin/src/pages/App/index.js 10:44-52 2024-05-26 22:04:20 export 'NotFound' (imported as 'NotFound') was not found in '@strapi/helper-plugin' (possible exports: AnErrorOccurred, AppInfoContext, AppInfoProvider, AppInfosContext, AppInfosProvider, AutoReloadOverlayBlockerContext, AutoReloadOverlayBlockerProvider, Body, CheckPagePermissions, CheckPermissions, ConfirmDialog, ContentBox, ContentManagerEditViewDataManagerContext, CustomFieldsContext, CustomFieldsProvider, DateTimePicker, DynamicTable, EmptyBodyTable, EmptyStateLayout, FilterListURLQuery, FilterPopoverURLQuery, Form, GenericInput, GuidedTourContext, GuidedTourProvider, InjectionZone, LibraryContext, LibraryProvider, Link, LinkButton, LoadingIndicatorPage, NoContent, NoMedia, NoPermissions, NotAllowedInput, NotificationsContext, NotificationsProvider, OverlayBlockerContext, OverlayBlockerProvider, PageSizeURLQuery, PaginationURLQuery, RBACContext, RBACProviderContext, ReactSelect, RelativeTime, RemoveRoundedButton, Root, SearchURLQuery, SettingsPageTitle, SortIcon, Status, StopPropagation, StrapiAppContext, StrapiAppProvider, Table, TrackingContext, TrackingProvider, auth, contentManagementUtilRemoveFieldsFromData, difference, findMatchingPermissions, formatContentTypeData, formatPermissionsForRequest, getAPIInnerErrors, getFetchClient, getFileExtension, getOtherInfos, getType, getYupInnerErrors, hasPermissions, normalizeAPIError, onRowClick, prefixFileUrlWithBackendUrl, prefixPluginTranslations, pxToRem, request, setHexOpacity, shouldCheckPermissions, stopPropagation, to, translatedErrors, useAPIErrorHandler, useAppInfo, useAppInfos, useAutoReloadOverlayBlocker, useCMEditViewDataManager, useCallbackRef, useClipboard, useCollator, useCustomFields, useFetchClient, useFilter, useFocusInputField, useFocusWhenNavigate, useGuidedTour, useLibrary, useLockScroll, useNotification, useOverlayBlocker, usePersistentState, useQuery, useQueryParams, useRBAC, useRBACProvider, useSelectionState, useStrapiApp, useTableContext, useTracking, wrapAxiosInstance) 2024-05-26 22:04:20 @ ../node_modules/strapi-plugin-cookie-manager/admin/src/index.js 2024-05-26 22:04:20 @ ../node_modules/strapi-plugin-cookie-manager/strapi-admin.js 2024-05-26 22:04:20 @ ./.strapi/client/app.js 5:0-70 17:22-35 2024-05-26 22:04:20 2024-05-26 22:04:20 ERROR in ./src/api/cookie/controllers/cookie.ts:7:47 2024-05-26 22:04:20 TS2345: Argument of type '"api::cookie.cookie"' is not assignable to parameter of type 'ContentType'. 2024-05-26 22:04:20 5 | import { factories } from '@strapi/strapi' 2024-05-26 22:04:20 6 | 2024-05-26 22:04:20 > 7 | export default factories.createCoreController('api::cookie.cookie'); 2024-05-26 22:04:20 | ^^^^^^^^^^^^^^^^^^^^ 2024-05-26 22:04:20 8 | 2024-05-26 22:04:20 2024-05-26 22:04:20 ERROR in ./src/api/cookie/routes/cookie.ts:7:43 2024-05-26 22:04:20 TS2345: Argument of type '"api::cookie.cookie"' is not assignable to parameter of type 'ContentType'. 2024-05-26 22:04:20 5 | import { factories } from '@strapi/strapi'; 2024-05-26 22:04:20 6 | 2024-05-26 22:04:20 > 7 | export default factories.createCoreRouter('api::cookie.cookie'); 2024-05-26 22:04:20 | ^^^^^^^^^^^^^^^^^^^^ 2024-05-26 22:04:20 8 | 2024-05-26 22:04:20 2024-05-26 22:04:20 ERROR in ./src/api/cookie/services/cookie.ts:1:18 2024-05-26 22:04:20 TS2304: Cannot find name 'createCoreService'. 2024-05-26 22:04:20 > 1 | module.exports = createCoreService('api::cookie.cookie', ({ strapi }) => ({ 2024-05-26 22:04:20 | ^^^^^^^^^^^^^^^^^ 2024-05-26 22:04:20 2 | async find(params) { 2024-05-26 22:04:20 3 | const { pagination } = await super.find(params); 2024-05-26 22:04:20 4 | const results = await strapi.entityService.findMany("api::cookie.cookie", Object.assign(params, {