TypeError: contentLib.publish is not a function

Enonic version: enonic 6.4.3
OS: Ubuntu server 14.04

On my production environment does not work publish content, I have many problems, the error that returns me is always:

com.enonic.xp.portal.PortalException: TypeError: contentLib.publish is not a function

check all the calls and they are well, came working well, can you help me?

Hi,

Is the lib (content) required in the top of your controller before calling the function?

Also, is it possible to upgrade to latest XP, 6.11, as many things are fixed since your version?

In addition, please paste your code in a Github Gist and add a link here so that we know what you wrote =)

Best regards,
Bobby

hi Bobby,

i can’t upgrade on this moment, is my production enviroment,

i call the lib on top

var contentLib = require(’/lib/xp/content’);

and i use it here:

var normalizePublish = contentLib.publish({
keys: [result._id],
sourceBranch: ‘draft’,
targetBranch: ‘master’,
includeChildren: true,
includeDependencies: true
});

i have 4 projects on that version, but i have that error on all proyects

jeje really i need help

You built your app with the same api-version as you run in production?

1 Like

yes! thanks,

i have defined another version on gradle properties ,

my production enviroment: 6.4.0

my local enviroment: 6.4.3

it works! thanks again Runar

2 Likes