Is not a function error for content.publish

Enonic version: 6.15.1
OS: Linux

Hi!

I am getting the same errors like in this thread:
https://discuss-3.enonic.com/t/typeerror-contentlib-publish-is-not-a-function/1211

I am getting it when I try to use content.publish, portal.loginUrl and portal.idProviderUrl. The same error might appear for some other functions, but I didn’t test all of them. Most of functions work correct.

The gradle.properties file uses the correct version(6.15.1) and I have also tried to change version manually by editing build.gradle file. I saw it downloading the correct version when building, so I assume the issue might be somewhere else.

Both libs are also included at a start of a file:

var portal = require('/lib/xp/portal');
var content = require('/lib/xp/content');

Thanks!

A quick guess: Your application is using a library that is including old versions of the portal and the content lib.
What are the libraries (+versions) your application is using?

How can I check the version?
In my build.gradle file I have these lines:

include “com.enonic.xp:lib-content:${xpVersion}”
include “com.enonic.xp:lib-portal:${xpVersion}”

And these lines in gradle.properties:

xpVersion = 6.15.1

I used this command for gradle to rebuild all the libs and deploy:

gradlew deploy --no-build-cache --recompile-scripts --refresh-dependencies --rerun-tasks

Is there any way I can check the version?

Thanks!

No other include except these 2 lines?

include “com.enonic.xp:lib-content:${xpVersion}”
include “com.enonic.xp:lib-portal:${xpVersion}”

Here is the full list:

compile "com.enonic.xp:core-api:${xpVersion}"
compile "com.enonic.xp:portal-api:${xpVersion}"
include "com.enonic.xp:lib-content:${xpVersion}"
include "com.enonic.xp:lib-portal:${xpVersion}"
include "com.enonic.xp:lib-thymeleaf:${xpVersion}"
include 'com.enonic.lib:util:1.1.1'
include "com.enonic.xp:lib-i18n:${xpVersion}"
include "com.enonic.lib:lib-http-client:1.0.0"
include 'com.enonic.lib:menu:1.2.0'
include "com.enonic.xp:lib-node:${xpVersion}"
include "com.enonic.xp:lib-context:${xpVersion}"
include 'com.enonic.xp:lib-mustache:6.1.0'
include "com.enonic.xp:lib-auth:${xpVersion}"
include "com.enonic.xp:lib-mail:${xpVersion}"
include "com.enonic.xp:lib-repo:${xpVersion}"

These 2 libraries are problematic:

'com.enonic.lib:util:1.1.1'
'com.enonic.lib:menu:1.2.0'

Upgrade the versions of these libraries. A least to the following versions:

'com.enonic.lib:util:1.2.1'
'com.enonic.lib:menu:1.3.1'
1 Like

Best would be the latest of each (I just saw that your application requires 6.15.1 so no compatibility problem here):

'com.enonic.lib:util:1.3.0'
'com.enonic.lib:menu:2.0.1'
1 Like

Upgrading to

'com.enonic.lib:util:1.2.1'
'com.enonic.lib:menu:1.3.1'

did not solve my issue, but upgrading to

'com.enonic.lib:util:1.3.0'
'com.enonic.lib:menu:2.0.1'

fixed it.

Thank you very much for help!

3 Likes