contentacms / contentajs

A nodejs server that proxies to Contenta CMS and holds custom code.
MIT License
102 stars 25 forks source link

Error on yarn start #11

Open rick02840 opened 6 years ago

rick02840 commented 6 years ago

Followed install instructions here: https://github.com/contentacms/contentajs/blob/master/docs/install.md

Error on yarn start:

yarn start
yarn run v1.7.0
warning package.json: No license field
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
node --version
v10.7.0
yarn --version
1.7.0

On my Mac:

/contenta/contentacms << installed contenta_jsonapi

/contenta/contentjs << installed this here, contents as follows:

config << has local.yml node_modules package.json yarn.lock

I ran yarn start from within /contenta/contentjs

rick02840 commented 6 years ago

Update: reinstalled using this instead of composer:

curl -Lo contenta.tar.gz https://github.com/contentacms/contentajs/archive/master.tar.gz`

First yarn start complained babel is missing. Ran npm install Second yarn start has lots of these errors:

SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (/contenta/contentajs/site/lib/helpers/app.js:48:27)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/contenta/contentajs/site/lib/helpers/workers/web.js:12:13)
undefined:1
undefined

BTW no worries, juts providing feedback.

e0ipso commented 6 years ago

Thanks @rick02840 for the feedback. This is deeply appreciated. It seems that there is a problem getting some configuration from your Contenta CMS. The error code is making it hard to debug. I'll see if I can have more explicit errors.

In the mean time, have you verified that nodejs has networking and can talk to Drupal?

rick02840 commented 6 years ago

Hi Mateu,

I do not know that much about nodejs, so not sure how to test it has networking, etc.

I can confirm these things: My contentacms is running fine on my local here: http://contentacms:8888 and I see the api working here: http://contentacms:8888/admin/api I use MAMP locally. My contentajs in in a separate folder on my Mac, outside of the contentacms, like this:

Sites/ contentacms/ contntentajs/

My contntentajs/config/local.yml has this in it:

cms:
  host: http://contentacms:8888

cors:
  origin:
    # It's OK to use '*' in local development.
    - '*'

That is per instructions here ("Configure"): https://github.com/contentacms/contentajs/blob/master/docs/install.md

Hmmmm... wonder how it knows to use local.yml ?

Other info:

node -v
v9.11.2 <<< I moved this down from version 10 yarn -v 1.7.0

Thanks,

Rick

swr82 commented 6 years ago

Same issue here. It looks like api path is setup to /jsonapi by default. It looks like api paths must be provided in local.yml file as well or it uses an empty array... Can you provide an example env: from yml config file please?

Below code snippet from file: contentajs-master/lib/helpers/app.js:48:27

const jsonApiPrefix = .get(process, 'env.jsonApiPrefix', '/api'); const jsonApiPaths = JSON.parse(.get(process, 'env.jsonApiPaths', '[]'));

SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at Object.<anonymous> (/Users//Projects/JS/contentajs-master/lib/helpers/app.js:48:27) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object.<anonymous> (/Users//Projects/JS/contentajs-master/lib/helpers/workers/web.js:12:13)

swr82 commented 6 years ago

I'e noticed there's an 500 error before Syntax error I've posted...

/jsonrpc url failes...

Successfully compiled 34 files with Babel. {"level":50,"time":1533723299511,"msg":"Response code 500 (500 Service unavailable (with message))","pid":3559,"hostname":"XXX","type":"Error","stack":"HTTPError: Response code 500 (500 Service unavailable (with message))\n at stream.catch.then.data (/contentajs-master/node_modules/got/index.js:386:13)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:188:7)","name":"HTTPError","host":"192.168.100.103","hostname":"192.168.100.103","method":"GET","path":"/jsonrpc?query=","protocol":"http:","url":"http://192.168.100.103/jsonrpc","statusCode":500,"statusMessage":"500 Service unavailable (with message)","headers":{"date":"Wed, 08 Aug 2018 10:14:59 GMT","server":"Apache/2.4.18 (Ubuntu)","cache-control":"no-cache, private","content-length":"2878","connection":"close","content-type":"text/html; charset=UTF-8"},"v":1}

ContentaCMS '/jsonrpc' url:

The website encountered an unexpected error. Please try again later. TypeError: Adaptor Shaper\Transformation\TransformationBase received invalid input data: [{"property":"","pointer":"","message":"NULL value found, but an array is required","constraint":"type","context":1},{"property":"","pointer":"","message":"NULL value found, but an object is required","constraint":"type","context":1},{"property":"","pointer":"","message":"Failed to match exactly one schema","constraint":"oneOf","context":1}] in Shaper\Transformation\TransformationBase->transform() (line 24 of /var/www/html/vendor/e0ipso/shaper/src/Transformation/TransformationTransformerTrait.php). Shaper\Transformation\TransformationBase->transform(NULL, Object) (Line: 114) Drupal\jsonrpc\Controller\HttpController->getRpcRequests(Object) (Line: 69) Drupal\jsonrpc\Controller\HttpController->resolve(Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67) Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51) Drupal\jsonapi\StackMiddleware\FormatSetter->handle(Object, 1, 1) (Line: 49) Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 665) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

e0ipso commented 6 years ago

There is an initial handshake between Contenta CMS and Contenta JS to pass some configuration along. That process seems to be breaking due to validation of the response. I will take a look and try to reproduce.

smira2000 commented 6 years ago

@swr82 @rick02840 make sure JSON-RPC 2.0 Core module on the cms side is enabled :)

swr82 commented 6 years ago

@smira2000 it is enabled :)

e0ipso commented 6 years ago

@smira2000 @swr82 this was an issue in Contenta CMS. That should be fixed now. That may require for you to re-install or apply the fix.

Can anyone re-try and confirm the fix?

swr82 commented 6 years ago

Hi @e0ipso,

Can anyone re-try and confirm the fix? No, still an issue with JSON RPC: https://github.com/contentacms/contenta_jsonapi/issues/309#issuecomment-415775196

rick02840 commented 6 years ago

@smira2000 Sorry been off this for a while, back on.

I did not have JSON-RPC 2.0 Core enabled. I did that but it did not help, still get the same yarn start errors as reported Jul 22. Above it says the fix is in Contenta CMS. I tried reinstalling with the quick install this time and got this error at the end:

The Quick Install uses SQLite to install Contenta CMS. This is not suited for production sites.
> scripts/install-sqlite.sh 'contentacms'
./scripts/install.sh: line 23: contentacms/vendor/drush/drush/drush: No such file or directory
 ERROR  Drush is required to install Contenta CMS. Please install Contenta CMS using Composer. See http://www.contentacms.org/#install
Script scripts/install-sqlite.sh handling the install:with-sqlite event returned with error code 5
./contentacms-quick-installer.sh: line 31: user-login: command not found
./contentacms-quick-installer.sh: line 32: runserver: command not found

But I do have composer and drush:

drush --version
 Drush Version   :  8.1.15
composer --version
Composer version 1.5.1 

Other info:

php -version
PHP 7.0.15
node --version
v8.11.3

My previous local Contenta CMS is running fine: http://contentacms:8888/admin/api

Assuming re-install of Contenta CMS is the fix, I will try doing that with the normal install when I get a chance. Just reporting this for now.

e0ipso commented 6 years ago

@rick02840 please provide the full path to the installer instead of just contentacms. For instance /tmp/contentacms.

There are 2 new videos linked in the README now, maybe those can help.