System Information
- Strapi Version: 4.8.2
- Operating System: Ubuntu
- Database: sqlite
- Node Version: 18.15.0
- NPM Version: 9.5.0
- Yarn Version: N/A
I defined a custom service as the following,
path: src/extensions/users-permissions/strapi-server.js
plugin.services['updateSomething'] = (userId) => {
console.log(userId);
}
When I tried to call this function in other places by calling strapi.service('plugin::users-permissions.updateSomething').updateSomething(passedId);
, the argument passedId
is unable to be retrieved by calling userId
inside plugin.services['updateSomething']
. Instead when I console.log(userId)
, the following is shown:
{
strapi: Strapi {
container: {
register: [Function: register],
get: [Function: get],
extend: [Function: extend]
},
dirs: { dist: [Object], app: [Object], static: [Object] },
isLoaded: true,
reload: [Function: reload] {
isWatching: [Getter/Setter],
isReloading: false
},
server: {
app: [Object],
router: [Router],
httpServer: [Server],
api: [Function: api],
use: [Function: use],
routes: [Function: routes],
mount: [Function: mount],
initRouting: [AsyncFunction: initRouting],
initMiddlewares: [AsyncFunction: initMiddlewares],
listRoutes: [Function: listRoutes],
listen: [Function: listen],
destroy: [AsyncFunction: destroy]
},
fs: {
writeAppFile: [Function: writeAppFile],
writePluginFile: [Function: writePluginFile],
removeAppFile: [Function: removeAppFile],
appendFile: [Function: appendFile]
},
eventHub: {
emit: [AsyncFunction: emit],
subscribe: [Function: subscribe],
unsubscribe: [Function: unsubscribe],
on: [Function: on],
off: [Function: off],
once: [Function: once],
destroy: [Function: destroy],
removeListener: [Function: off],
removeAllListeners: [Function: destroy],
addListener: [Function: on]
},
startupLogger: {
logStats: [Function: logStats],
logFirstStartupMessage: [Function: logFirstStartupMessage],
logDefaultStartupMessage: [Function: logDefaultStartupMessage],
logStartupMessage: [Function: logStartupMessage]
},
log: DerivedLogger {
_readableState: [ReadableState],
readable: true,
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_writableState: [WritableState],
writable: true,
allowHalfOpen: true,
_transformState: [Object],
silent: undefined,
format: [Format],
defaultMeta: null,
levels: [Object],
level: 'silly',
exceptions: [ExceptionHandler],
rejections: [RejectionHandler],
profilers: {},
exitOnError: true,
[Symbol(kCapture)]: false
},
cron: {
add: [Function: add],
remove: [Function: remove],
start: [Function: start],
stop: [Function: stop],
destroy: [Function: destroy],
jobs: [Array]
},
telemetry: {
isDisabled: [Getter],
register: [Function: register],
bootstrap: [Function: bootstrap],
destroy: [Function: destroy],
send: [AsyncFunction: send]
},
requestContext: { run: [AsyncFunction: run], get: [Function: get] },
customFields: { register: [Function: register] },
admin: {
register: [Function (anonymous)],
bootstrap: [AsyncFunction (anonymous)],
destroy: [AsyncFunction (anonymous)],
config: [Object],
policies: [Object],
routes: [Array],
services: [Object],
controllers: [Object],
contentTypes: [Object],
middlewares: [Object]
},
app: {
register: [Function: register],
bootstrap: [Function: bootstrap]
},
components: {
'multiple-choice.option': [Object],
'question.multiple-choice': [Object],
'question.short-question': [Object]
},
webhookRunner: WebhookRunner {
eventHub: [Object],
logger: [DerivedLogger],
webhooksMap: Map(0) {},
listeners: Map(0) {},
config: [Object],
queue: [WorkerQueue]
},
db: Database {
metadata: [Metadata [Map]],
config: [Object],
dialect: [SqliteDialect],
connection: [Function],
schema: [Object],
migrations: [Object],
lifecycles: [Object],
entityManager: [Object]
},
store: [Function: store] {
get: [AsyncFunction: get],
set: [AsyncFunction: set],
delete: [AsyncFunction: delete]
},
webhookStore: {
findWebhooks: [AsyncFunction: findWebhooks],
findWebhook: [AsyncFunction: findWebhook],
createWebhook: [Function: createWebhook],
updateWebhook: [AsyncFunction: updateWebhook],
deleteWebhook: [AsyncFunction: deleteWebhook]
},
entityValidator: {
validateEntityCreation: [AsyncFunction (anonymous)],
validateEntityUpdate: [AsyncFunction (anonymous)]
},
entityService: {
implementation: [Object],
decorate: [Function: decorate],
uploadFiles: [Function (anonymous)],
wrapParams: [Function (anonymous)],
emitEvent: [Function (anonymous)],
findMany: [Function (anonymous)],
findPage: [Function (anonymous)],
findWithRelationCountsPage: [Function (anonymous)],
findWithRelationCounts: [Function (anonymous)],
findOne: [Function (anonymous)],
count: [Function (anonymous)],
create: [Function (anonymous)],
update: [Function (anonymous)],
delete: [Function (anonymous)],
deleteMany: [Function (anonymous)],
load: [Function (anonymous)],
loadPages: [Function (anonymous)]
}
}
}
Does anyone know what is going on?