Forums › Forums › OroPlatform › OroPlatform – Installation/Technical Issues or Problems › NotesApi null reference error
This topic contains 10 replies, has 2 voices, and was last updated by Yurii Muratov 6 years, 1 month ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- March 14, 2018 at 7:51 am #35436
When using the rest api, I receive a null reference error in the NoteApiHandler at this line:
Stepping through the code, the configManager does have numerous providers and of course none for the note entity. Is this a known issue and what can be done?
Thanks for the help.
- CreatorTopic
- AuthorReplies
- March 14, 2018 at 8:50 am #35437
Re-reading this, I may have been a little confusing. The value for $noteProvider in line 85 is null and actually has the exception at:
when hasConfig() is called. Sorry for any confusion.
March 14, 2018 at 9:07 am #35438Hello, Chris.
Thank you for reporting the issue. Yes. The issue exists at platform from version 2.0.
I have created an issue to fix (Internal ID – BAP-16755).
But, please consider a possibility to use JSON API. It has much more capabilities.
For example, to create a note with JSON API, you have to call POST request to /api/notes with data in JSON API format:
YAML123456789101112131415161718{"data":{"type":"notes","attributes":{"message":"<p>test note message</p>"},"relationships":{"activityTargets":{"data":[{"type":"accounts","id":"7"}]}}}}Please find more information here: https://oroinc.com/orocrm/doc/2.3/book/data-api and at JSON API specification site: http://jsonapi.org/format/
March 14, 2018 at 9:34 am #35439Yurii,
Thank you for the response. I had looked at the json api, however the PATCH method returns a 502 response (bad gateway). Get requests for /api/notes/{id} work and return 200.
Is this too a known issue?
March 14, 2018 at 9:48 am #35440Hmm, it’s very strange. I have just re-check PATCH request for the notes. And all work for me.
Could you please tell me what version of the platform do you use? And please send to me full response of your request to be able to better understand the problem.
Thanks.
March 15, 2018 at 6:15 am #35441Using the JSON API with PATCH /api/notes/3 I receive the following response headers:
502 Bad Gateway
date: Wed, 14 Mar 2018 19:38:08 GMT
server: nginx/1.12.2
connection: keep-alive
content-length: 575
content-type: text/htmlPlease note that GET works just fine.
March 15, 2018 at 9:27 am #35442Hello, Chris.
Thanks for sending the response headers. But as i can see, the response have body (content-length: 575).
Could you please send full response with the body?Please check if your nginx configuration is correct. There is a blog post that describe how to correct configure nginx for ORO applications https://oroinc.com/orocrm/blog/orocrm-installation-on-server-with-nginx-php-fpm.
Also please check if log files have any records with errors.
March 15, 2018 at 10:53 am #35443My request body is:
{
“data”:{
“type”:”notes”,
“id”:”3″,
“attributes”:{
“message”:”Test Message”,
“subject”:”Test Subject”
}
}
}and the response body is:
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor=”white”>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.12.2</center>
</body>
</html>
<!– a padding to disable MSIE and Chrome friendly error page –>
<!– a padding to disable MSIE and Chrome friendly error page –>
<!– a padding to disable MSIE and Chrome friendly error page –>
<!– a padding to disable MSIE and Chrome friendly error page –>
<!– a padding to disable MSIE and Chrome friendly error page –>
<!– a padding to disable MSIE and Chrome friendly error page –>I’m unsure of an environment issue being present if the same endpoint works using get.
March 15, 2018 at 11:29 am #35444Chris, thank you for your request body.
I have tried it on my local environment and see that it is invalid because notes API resource do not have subject attribute. The Oro response on this request is 400 Bad Request with body:
123456789{"errors": [{"status": "400","title": "extra fields constraint","detail": "This form should not contain extra fields: \"subject\""}]}Please try to send next request:
123456789{"data":{"type":"notes","id":"3","attributes":{"message":"Test Message"}}}And send to me the result of this request.
It might help to understand the reason of the problem.
Also, it will be helpful if you will send your nginx configuration because for now i see the problem is in it.
March 16, 2018 at 6:53 am #35445Using your request here is the response:
PHP12345678910111213<html><head><title>502 Bad Gateway</title></head><body bgcolor="white"><center><h1>502 Bad Gateway</h1></center><hr><center>nginx/1.12.2</center></body></html><!-- a padding to disable MSIE and Chrome friendly error page --><!-- a padding to disable MSIE and Chrome friendly error page --><!-- a padding to disable MSIE and Chrome friendly error page --><!-- a padding to disable MSIE and Chrome friendly error page --><!-- a padding to disable MSIE and Chrome friendly error page --><!-- a padding to disable MSIE and Chrome friendly error page -->Here is the contents of nginx.conf
PHP123456789101112131415161718192021222324252627282930313233343536373839user www-data;worker_processes 1;worker_rlimit_nofile 1024;error_log /var/log/nginx/error.log;pid /var/run/nginx.pid;events {worker_connections 1024;}http {include /etc/nginx/mime.types;default_type application/octet-stream;access_log /var/log/nginx/access.log;sendfile on;server_tokens on;types_hash_max_size 1024;types_hash_bucket_size 512;server_names_hash_bucket_size 128;server_names_hash_max_size 512;keepalive_timeout 65;tcp_nodelay on;gzip on;gzip_disable "MSIE [1-6]\.(?!.*SV1)";include /etc/nginx/conf.d/*.conf;include /etc/nginx/sites-enabled/*;}conf.d/proxy.conf (included via nginx.conf)
PHP12345678910111213141516proxy_temp_path /var/nginx/proxy_temp;client_body_temp_path /var/nginx/client_body_temp;proxy_redirect off;client_max_body_size 10m;client_body_buffer_size 128k;proxy_connect_timeout 600s;proxy_send_timeout 600s;proxy_read_timeout 600s;proxy_buffers 4 256k;proxy_buffer_size 128k;proxy_http_version 1.0;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_headers_hash_bucket_size 64;sites-enabled/_.conf (via include)
PHP12345678910111213server {listen *:80;server_name _;client_max_body_size 1m;root /var/www/html;index index.html index.htm;access_log /var/log/nginx/_.access.log;error_log /var/log/nginx/_.error.log;sendfile off;}sites-enabled/nxv_pfxgry0qx28p.conf
PHP12345678910111213141516171819202122232425262728293031323334353637server {listen *:80;server_name aecrm.dev aecrm.test aecrm.local;client_max_body_size 50m;root /var/www/web;index index.html index.htm index.php;access_log /var/log/nginx/nxv_pfxgry0qx28p.access.log;error_log /var/log/nginx/nxv_pfxgry0qx28p.error.log;location ~ [^/]\.php(/|$) {set $path_info $fastcgi_path_info;root /var/www/web;fastcgi_index app.php;fastcgi_split_path_info ^(.+\.php)(/.*)$;include /etc/nginx/fastcgi_params;fastcgi_pass 127.0.0.1:9000;fastcgi_param APP_ENV dev;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;}location / {root /var/www/web;try_files $uri $uri/ /app.php$is_args$args;autoindex on;index app.php;}sendfile off;}March 16, 2018 at 7:38 am #35446Chris, thank you for the configs.
I will try to reproduce the issue.
Meanwhile, could you please check ngnix error logs for errors?
- AuthorReplies
The forum ‘OroPlatform – Installation/Technical Issues or Problems’ is closed to new topics and replies.