question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Microservice APIs returning empty response (master)

See original GitHub issue
Overview of the issue

Microservice APIs return empty responses (generated with master branch). I’m guessing it affects all Zuul routes since getting the account from the UAA is also broken.

Motivation for or Use Case

Generate a working microservice architecture

Reproduce the error

Generate a gateway Generate a microservice Generate an entity on the microservice (then on gateway) Start registry, gateway, microservice Attempt to access entity page

In browser developer tools, you can see on the network tab the response is null. You can also see errors logged to the console, such as core.js?09c9:15713 ERROR TypeError: Cannot read property 'length' of null at JhiParseLinks.parse (ng-jhipster.js?8ee9:1971)

Related issues

Don’t think so

Suggest a Fix

Unsure, maybe related to SB2.1? Only affects master

JHipster Version(s)

Master, v5.8.2 works fine.

JHipster configuration
Gateway .yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.mycompany.myapp",
      "nativeLanguage": "en",
      "microservicePath": "../msmaster"
    },
    "jhipsterVersion": "5.8.1",
    "applicationType": "gateway",
    "baseName": "gway",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "npm",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en"
    ],
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": []
  }
}
Microservice .yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.mycompany.myapp",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "5.8.1",
    "applicationType": "microservice",
    "baseName": "ms",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "serverPort": "8081",
    "authenticationType": "jwt",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "enableTranslation": true,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "clientPackageManager": "npm",
    "nativeLanguage": "en",
    "languages": [
      "en"
    ],
    "skipClient": true,
    "skipUserManagement": true,
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": []
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Foo {
  name String
}
dto Foo with mapstruct
paginate Foo with pagination
service Foo with serviceClass
microservice Foo with ms
filter Foo
clientRootFolder Foo with ms

  • Checking this box is mandatory (this is just to show you read everything)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
pascalgrimaudcommented, Feb 15, 2019

Finally got it ! The problem comes from this file: https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/src/main/java/package/config/lazy/LazyInitBeanFactoryPostProcessor.java.ejs

If I disable it for dev, it works. Ping @jdubois as you coded this file. Can you help us on this ticket ?

0reactions
PierreBessoncommented, Mar 11, 2019

So it seems we just need to add private Class<?>[] exclusionList = {ZuulFilterInitializer.class}; for gateway apps. As solved here: https://github.com/mraible/jhipster-ms-oidc-improved/pull/1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get microservices HTTP errors from JHipster API Gateway
I have a problem when sending HTTP errors from my microservices. The gateway seems to ignore the response from the microservice and generate...
Read more >
How a RESTful API server reacts to requests - O'Reilly
Even if all stations were inactive, we could return an empty list of stations. The response here always include a body, therefore success ......
Read more >
Guide to Spring Boot REST API Error Handling - Toptal
Implement consumer-friendly support to a Spring Boot REST API by hiding implementation details and delivering easily digestible fields.
Read more >
Implement health check APIs for microservices - IBM
Start with a minimum viable health check API that can respond when you ask it if a service is available. Depending on the...
Read more >
Pattern: Microservice Architecture
The application might also expose an API for 3rd parties to consume. ... exchanging messages with other systems; and returning a HTML/JSON/XML response....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found