I successfully finished steps 1 to 3. Now I am stucking on step 4:
I scheduled my task with the following code:
const schedulerLib = require('/lib/xp/scheduler');
const url = app.config.url || ""
const root = app.config.root || "/";
const scheduleNewsFetching = schedulerLib.create({
name: 'Fetch News',
descriptor: `${app.name}:fetchnews`,
description: 'fetches news from news api',
user: 'user:system:su',
enabled: true,
config: {
url,
root
},
schedule: {type: 'CRON', value: '5 * * * *', timeZone: 'GMT+1:00'}
});
log.info("created scheduler %s", scheduleNewsFetching._id);
I get the following error:
2022-04-09 16:28:03,960 ERROR c.e.xp.portal.impl.main.MainExecutor - Error while executing org.lienas.webpack Application controller
java.util.concurrent.CompletionException: com.enonic.xp.node.NodeAccessException: Access denied to [/] for [CREATE] by user [unknown]
I also tried to change the context without success!
result = contextLib.run({
principals: ["role:system.admin"],
repository: 'system.scheduler',
branch: 'master'
}, callback);