I have a monolith application that under dev mode everything works ok. When I package the application for production the front-end does not work.
The back end runs ok.
Do you have any suggestions/advices how to debug this?
I have cleaned and reinstalled the node_modules and the yarn.lock file.
No difference.
Any advice would be really appreciated.
Using JHipster version installed locally in current project's node_modules Executing jhipster:info Options: Welcome to the JHipster Information Sub-Generator
##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
<details> <summary>.yo-rc.json file</summary> <pre> { "generator-jhipster": {
"promptValues": {
"packageName": "---"
},
"jhipsterVersion": "4.14.0",
"baseName": "devkit",
"packageName": "---",
"packageFolder": "---",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "no",
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "mssql",
"prodDatabaseType": "mssql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": false,
"jwtSecretKey": "replaced-by-jhipster-info",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": false } } </pre> </details>
##### **Environment and Tools**
java version "1.8.0_161" Java(TM) SE Runtime Environment (build
1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
git version 2.15.0.windows.1
node: v8.9.4
npm: 5.6.0
yeoman: 2.0.1
yarn: 1.3.2
Docker version 18.03.0-ce, build 0520e24
docker-compose version 1.20.1, build 5d8c71b2
Congratulations, JHipster execution is complete!
Trying to produce a jar instead of a war archive broke the application under prod mode. Changing the filename of the archive that will be produced is easy by simply including the <fileName> tag under the build tag but if you want to change the extensions then do not change the <packaging> tag since this will break the app under production.
UPDATE:
I found that simply renaming the file from war to jar by hand (manually) breaks the front end with the previous described error.
Related
I need to scrape some data from transfermarkt.com using parsehub, but when i try to load the website with parse hub I'm only met with:
This Stencil app is disabled for this browser.
Developers:
ES5 builds are disabled during development to take advantage of 2x faster build times.
Please see the example below or our config docs if you would like to develop on a browser that does not fully support ES2017 and custom elements.
Note that as of Stencil v2, ES5 builds and polyfills are disabled during production builds. You can enable these in your stencil.config.ts file.
When testing browsers it is recommended to always test in production mode, and ES5 builds should always be enabled during production builds.
This is only an experiment and if it slows down app development then we will revert this and enable ES5 builds during dev.
Enabling ES5 builds during development:
npm run dev --es5
For stencil-component-starter, use:
npm start --es5
Enabling full production builds during development:
npm run dev --prod
For stencil-component-starter, use:
npm start --prod
Current Browser's Support:
ES Module Imports: false
ES Dynamic Imports: false
Custom Elements: false
Shadow DOM: false
fetch: true
CSS Variables: true
Current Browser:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:65.0) Gecko/20100101 Firefox/65.0
I tried following the steps to enable ES5, but it does not work.
If i go to the website on the standard firefox browser it works like normal, but not in parsehub
That message indicates that the browser does not support JS modules. Looking at parsehub's FAQ they are using Firefox v54 which was released in 2017 and does not support JS modules.
Starting with version 2 Stencil has changed legacy browser support to be opt-in.
If you have access to the source code you can add legacy browser support using the following config:
export const config: Config = {
buildEs5: 'prod',
extras: {
cssVarsShim: true,
__deprecated__dynamicImportShim: true,
shadowDomShim: true,
safari10: true,
scriptDataOpts: true,
appendChildSlotFix: false,
cloneNodeFix: false,
slotChildNodesFix: true,
}
};
The only other options are:
ask the site to add those config changes and publish a new version
use a different scraper with a more recent version
I have created .testcaferc.json, I mentioned the browser and src in it. so I should be able to run tests without putting this in the command line.
But it does not seem to be reading my config file from the project folder.
{
"src": "c:/Testcafe/Login.js",
"browsers": "firefox",
"reporter": {
"name": "html",
"output": "reports/report.html"
},
"takeScreenshotsOnFails": true,
"screenshotPath": "/screenshots/"
}
Actual:
Using locally installed version of TestCafe.
ERROR No browser selected to test against.
Type "testcafe -h" for help.
Expected:
I should not ask for browser and test file parameter as both are provided in config file.
The configuration file is a feature added in v1.0.0. If you upgrade from 0.20.5 to 1.0.0 or later, you will be able to use the configuration file for your tests.
Release Notes:
https://github.com/DevExpress/testcafe/releases/tag/v1.0.0
Environment: Ubuntu 16.04, .NET Core SDK Preview 2.0.0 (006497), VSC 1.14.2
Things used to work fine under .net core 1. Now, I have upgraded my system to .net core 2.
From the command line, I created a new project and ran it:
$ dotnet new mvc
$ dotnet run
The webpage works as expected.
Now, I open the folder in VSC and tried to debug the app. First time, VCS helps create launch.json and tasks.json. Here is my tasks.json contents:
"version": "2.0.0",
"tasks": [
{
"taskName": "build",
"command": "dotnet",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
In the terminal view, I see that VCS tries to run the build command as dotnet <. This throws an error that preLaunchTask "build" exited with error code 129.
I tried to fix this by adding args: ["build"] to the task. This seems to fix the build but I now get another error about launch.json not being configured properly.
Wondering if there is some step that I simply missed. Regards.
The answer was provided by mvermef in his comment. I am just adding a new post here so I can mark it as an answer.
The problems with VSC are explained at https://github.com/dotnet/core/blob/master/release-notes/2.0/2.0.0-preview2-known-issues.md. The most important thing is that you remove your existing C# extension and replace it with the latest beta version. Now, if you create a new project from the command line and load it in VSC, you should be able to debug it.
When running a Cucumber test, using cucumber.api.cli.Main, the test is failing to recognise the certificates that are installed in the JDK.
I am running using the following:
IntelliJ 2016.1.2 (Build #IU-145.972)
JRE 1.8.0_74-b02
Plugin Cucumber for Java version: 999.999
It works, when run from the following gradle task, from the command line:
task functional(dependsOn: ['testClasses']) << {
javaexec {
main = "cucumber.api.cli.Main"
classpath = sourceSets.test.runtimeClasspath
args = ['--tags', '~#wip',
'--plugin', 'junit:build/junit-test-report.xml',
'--plugin', 'pretty',
'--plugin', 'html:build/cucumber-html-report',
'--plugin', 'json:build/cucumber-json-report.json',
'--glue', 'step_definitions',
'--strict',
'src/test/resources'
]
if(project.hasProperty("coverage")) {
jvmArgs = ["-javaagent:${configurations.codeCoverage.asPath}=destfile=${buildDir}/jacoco/jacoco.exec,sessionid=HSServ,append=false"]
}
}
}
But when I create a Run Configuration for Cucumber, using:
Main Class: cucumber.api.cli.Main
Glue: step_definitions
Feature or Folder path: /Users/xetius/application/src/test/resources/system_tasks/request/validation_handling/request/validate_hardware_fulfilment_request.feature
Program Arguments: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --name "^Pending details$"
Working Directory: /Users/xetius/application
It fails to recognise the certificates for connecting to the remote services.
I have configured IntelliJ to boot using the external JDK, into which I have installed the certificates using keytool, and I can see that it is using this JDK when running the configuration. I have also tried configuring Server Certificates, and importing the same certificate.
However, within IntelliJ, it throws an exception when connecting to remote services. It is also throwing the exception when gradle is run from within the IntelliJ terminal.
I have a legacy Symfony 2.0 project (version 2.0.11 to be precise) to which I'd like to add behat tests. As it's Symfony 2.0, it uses the deps vendor system rather than composer. I'm not in a position to upgrade the Symfony version or switch to composer at the moment.
I attempted to install behat using the following deps settings:
[Mink]
target=/Behat/Mink
git=git://github.com/Behat/Mink.git
version=v1.3.3
[MinkBundle]
target=/Behat/MinkBundle
git=git://github.com/Behat/MinkBundle.git
[BehatBundle]
target=/Behat/BehatBundle
git=git://github.com/Behat/BehatBundle.git
[Gherkin]
target=/Behat/Gherkin
git=git://github.com/Behat/Gherkin.git
version=v2.1.1
[Behat]
target=/Behat/Behat
git=git://github.com/Behat/Behat.git
version=v2.3.5
[Goutte]
target=/Goutte
git=git://github.com/fabpot/Goutte.git
(Yes, I know that the BehatBundle etc are outdated, but it looked like I'd need these outdated versions given that I'm using deps and sf2.0.)
When I run vendor/Behat/Behat/bin/behat, I then get the issue described here:
PHP Warning: require_once(behat/autoload.php): failed to open stream: No such file or directory in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/bin/behat on line 23
PHP Fatal error: require_once(): Failed opening required 'behat/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/bin/behat on line 23
I realised that behat 2.3.5 doesn't actually have an autoload.php file. I looked through Behat's tags on Github and realised that 2.1.3 was the latest version which had an autoload.php (actually autoload.php.dist, though every earlier version also had autoload.php.dist rather than autoload.php, so I assumed that this was it).
I therefore changed my behat version number in deps to v2.1.3, deleted my vendors and re-installed. The behat command had then changed, so I ran:
php vendor/Behat/Behat/bin/behat.php
I now saw this error:
PHP Fatal error: Class 'Symfony\Component\Console\Application' not found in /home/sam/wo-code/PersonaBubble/vendor/Behat/Behat/src/Behat/Behat/Console/BehatApplication.php on line 26
Does anyone know what the correct versions of behat etc are that I should use to get it working with Symfony 2.0 and deps? Or is there some other step that I'm missing.
PS I ended up running behat via PHAR (although this had other problems so I abandoned it as not worth it). However, I really want to know how to do it via standard vendors install, hence this post.
I'm not in a position to upgrade the Symfony version or switch to
composer at the moment.
I understand what you say but example below might give you a bit of hint I hope! I hope it helps a bit.
I'm sharing what I have been using for all my Symfony2 projects. Behat+Mink+Selenium
CONPOSER:
You need certain versions so that eveyone use same versions of everthing.
mySymfonyProject/composer.json:
"require": {
"behat/behat": "2.5.*#stable",
"behat/behat-bundle": "1.0.0",
"behat/symfony2-extension": "1.1.2",
"behat/mink": "1.5.0",
"behat/mink-extension": "~1.3",
"behat/mink-selenium2-driver": "1.1.1",
"behat/mink-goutte-driver": "1.0.9"
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev",
BEHAT
mySymfonyProject/behat.yml:
default:
context:
class: FeatureContext
extensions:
Behat\Symfony2Extension\Extension:
mink_driver: true
kernel:
env: test
debug: true
Behat\MinkExtension\Extension:
base_url: 'http://mysymfonyproject.local/app_test.php/'
javascript_session: selenium2
browser_name: firefox
goutte: ~
selenium2: ~
paths:
features: %behat.paths.base%/src
bootstrap: %behat.paths.features%/Context
SELENIUM
Download into your project. It is here, make sure you download 2.43.1 version which is in the middle of the page.
Run it: java -jar selenium-server-standalone-2.43.1.jar
CONTEXT FEATURE
mySymfonyProject/src/Site/CommonBundle/Features/Context/FeatureContext.php
<?php
namespace Site\CommonBundle\Features\Context;
use Behat\MinkExtension\Context\MinkContext;
use Behat\Symfony2Extension\Context\KernelAwareInterface;
use Symfony\Component\HttpKernel\KernelInterface;
class FeatureContext extends MinkContext implements KernelAwareInterface
{
/**
* Hold Symfony kernel object.
*
* #var object Kernel Object.
*/
protected $kernel;
/**
* Helps to use doctrine and entity manager.
*
* #param KernelInterface $kernelInterface Interface for getting Kernel.
*/
public function setKernel(KernelInterface $kernelInterface)
{
$this->kernel = $kernelInterface;
}
//And your own methods
}
TESTS
When you have feature files you can run them like this (this runs all in one go. for more info read behat doc):
bin/behat #SiteCommonBundle