ember-cli test not working with phantomjs in docker - ember.js

When running ember test --host 172.17.0.2 --test-port 4450, I'm getting the following error.
Error: Browser failed to connect within 30s. testem.js not loaded?
Since I'm using a docker container I'm assuming I need to update the host and port to the open docker host and port.
This is my testem.js file
/*jshint node:true*/
module.exports = {
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"phantomjs_debug_port": 4500,
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
};

This is a general problem you'll see when testing an ember application in continuous integration environments. Multiple users have posted their experiences with the possible bug in this GitHub issue. 2 answers come to mind.
Per Testem's author, you can increase the browser connection timeout.
Compare your ember application's .travis.yml with the canonical version in the ember-new-output repository here. The ember-cli core team and community members have invested a lot of time refining and debugging that .travis.yml to make it work well with ember applications.

Related

error when deploy to AWS after build using vue3 + vite

First off all excuse the bad english..
Im develop/build using vue3 + vite2.
Deploy the 'dist' folder on AWS EC2 and run the server with nginx.
And when I connect to that page, I get an error that I can't see.
Has anyone ever seen an error like this?
(When build/run locally, it works normally without errors.)
after a day of suffering, i found that it was due vueI18n plugin in the vite.config.ts file.
import vueI18n from '#intlify/vite-plugin-vue-i18n';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [
vue(),
vueI18n({
include: path.resolve(__dirname, './path/to/src/locales/**'),
}),
],
....
I don't know for what reason,
When I delete that plugin, it worked fine.
the reason for adding vueI18n plugin is because a warning related to bundle install occurred.
i guess is that the plugin conflicts with vite's build environment.

trying to debug "502 Bad Gateway" error after deploying react app to gcp?

I've deployed a React app via "gcloud app deploy". The "gcloud app browse" command opens a browser which tries to load for a while but then displays a browser title of "502 Bad Gateway." I found the following troubleshooting page:
https://cloud.google.com/endpoints/docs/openapi/troubleshoot-response-errors#gae_errors
The following info on the troubleshoting page appears to be a good match for my scenario:
"An error code 502 with BAD_GATEWAY in the message usually indicates
that App Engine terminated the application because it ran out of
memory. The default App Engine flexible VM only has 1GB of memory,
with only 600MB available for the application container."
But I don't see any "out of memory" error reference in my logs for this. I think I probably need to ensure that I "gcloud app deploy" with a proper app.yaml file. I'm having problems identifying what is a valid minimum yaml file for my React app for which I can be assured that my "gcloud app deploy" will have the expected result. I found the following reference which appears to be a good starting point:
https://cloud.google.com/endpoints/docs/openapi/get-started-app-engine
^^^ This page refers to the following yaml sample code:
https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/endpoints/getting-started/src/main/appengine/app.yaml
But the url refers to "java-docs-sample" so not sure if this is a vaid yaml file for a React app deployment. Can you provide some guidance on this? I'm really just looking for the minimum yaml file that I can use for a successful deployment. This is the structure of the yaml file that I used for my initial "gcloud app deploy", and the deployment process appeared to indicate success, but not sure if there is any type of fatal flaw here or anything else that may be missing:
runtime: nodejs
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
From what I understand, you just want a minimal good app.yaml for react apps as the out of memory seems to be the issue if everything else is correct.
A sample app.yaml for react is the following:
# [START runtime]
runtime: nodejs
env: flex
# [END runtime]
# [START handlers]
handlers:
- url: /
static_files: index.html
upload: index.html
# [END handlers]
But you need to modify your handlers according to your needs/ configuration.
502 error sometimes indicates that your app has an issue itself. So it's better to test locally first and make sure your app is working.
Then for the memory part, you can try specifying the instance type to be one with a higher memory. If it still throws the same error then most likely the issue is within your app or dependencies.
I think there is something about react-scripts start that google cloud doesn't like; I've had trouble with this (react app + google cloud deployment) twice in completely different environments (one had docker and one did not); but the first time I never posted anything to stack overflow so I had to go through the pain again :p
Try changing the package.json file to not use react-scripts start when you run npm run start.
Note that this will overwrite the npm run start and npm start command, so if you use this, you can also update the package json with another keyword such as local and change your local running process to involve writing npm run local
"scripts": {
"start": "serve -s build",
"local": "react-scripts start",
"build": "react-scripts build",
...
},
A working repo

Readthedocs local server stuck on Triggered state during build

I have installed a local instance of Readthedocs server, but anytime I try to build a github repository the app gets stuck in the Triggered state!.
There is no errors or exceptions, just regular info messages:
[25/Apr/2017 14:21:11] INFO [readthedocs.projects.utils:81] Running: 'ln -nsf /var/www/my-project/user_builds/test1/rtd-builds/latest /var/www/my-project/public_web_root/test1/en/latest' [/var/www/my-project]
[25/Apr/2017 14:21:11] INFO [readthedocs.projects.tasks:844] (Build) [test1:] Updating static metadata
Any idea what could be causing this issue?
so I had this problem, and there seems to be a lot of different things that could cause it, because I've seen various postings about it on different forums however none of the solutions posted helped me. The only posting i have book marked is this github issue.
for me I found that the documentation would build if I ran the command python manage.py runserver 0.0.0.0:8000, but would be stuck in a triggered state if I used my computers ip address; the solution was to use the above command but to add the following to readthedocs/settings/local_settings.py :
import os
# Set this to the root domain where this RTD installation will be running
PRODUCTION_DOMAIN = os.getenv('RTD_PRODUCTION_DOMAIN', '10.x.x.x:8000')
# Enable private Git doc repositories
ALLOW_PRIVATE_REPOS = True
best of luck.

Deploying Meteor App on AWS EC2 using mup. Browser returns: 'took too long to respond'

I'm trying to deploy a Meteor app using mup and an AWS EC2 micro instance.
I've followed the whole tutorial here http://www.curtismlarson.com/blog/2015/11/03/deploy-meteor-to-aws/, successfully running mup deploy.
However when I go to the instance's Public IP on google chrome or firefox, it simply says:
myapp.com took too long to respond.
If anyone could tell me how I can find the source of this problem, I'd be extremely grateful!
Here's my mup.json:
{
// Server authentication info
"servers": [
{
"host": "52.***.***.***",
"username": "ubuntu",
"pem": "~/************.pem"
}
],
// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
"nodeVersion": "0.10.41",
// Install PhantomJS in the server
"setupPhantom": true,
// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,
// Application name (No spaces)
"appName": "menus",
// Location of app (local directory)
"app": "~/menus",
// Configure environment
"env": {
"ROOT_URL": "http://myapp.com"
},
// Meteor Up checks if the app comes online just after the deployment
// before mup checks that, it will wait for no. of seconds configured below
"deployCheckWaitTime": 15
}
The "ROOT_URL": "http://myapp.com" line is exactly how it appears in the file ( I didn't know what else to choose).
Edit: Here's the /opt/menus/config/env.sh file:
#!/bin/bash
export PORT=80
export MONGO_URL=mongodb://127.0.0.1/menus
export ROOT_URL=http://localhost
#it is possible to override above env-vars from the user-provided values
export PORT=\8\0
export ROOT_URL=\h\t\t\p\:\/\/\m\y\a\p\p\.\c\o\m
export METEOR_SETTINGS=\{\"\p\u\b\l\i\c\"\:\{\}\}
export CLUSTER_ENDPOINT_URL=\h\t\t\p\:\/\/\5\2\.\2\0\1\.\2\1\2\.\1\4\2\:\8\0
Those escapes definitely look out of place, but I feel like 1 wrong stroke could leave it still crashing! The fact that ROOT_URL is defined twice is concerning me. How exactly should I proceed?
For me mup still has a bug where the file /opt/myapp/config/env.sh generated by mup was incorrectly formatted (there were some extra spaces and extra escapes). You may want to check that, i.e., ssh into your instance and look at that file. If you need to fix it, do so, and then run mup restart from your development machine.
The second hypothesis I have is that mup doesn't interpret ~. So you may want to try using the resolved path for app, or just the relative path from where your mup.json lives.
Update:
As expected, the env.sh file is wrong (bug in mup). Try this:
#!/bin/bash
export PORT=80
export MONGO_URL=mongodb://127.0.0.1/menus
export ROOT_URL=http://localhost
#it is possible to override above env-vars from the user-provided values
export PORT=80
export ROOT_URL="http://myapp.com"
export METEOR_SETTINGS="{\"public\":{}}"
export CLUSTER_ENDPOINT_URL="http://52.201.212.142:80"

Running jest tests directly in Intellij Idea/WebStorm?

I'm using jest to write tests in my ReactJS application.
So far, to run my test suite, I need to type 'npm test'.
Here's the snippet from package.npm:
"scripts": {
"test": "./node_modules/.bin/jest",
(other stuff)
},
"jest": {
"unmockedModulePathPatterns": ["<rootDir>/node_modules/react"],
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"testFileExtensions": [
"es6",
"js"
],
"moduleFileExtensions": [
"js",
"json",
"es6"
]
},
Is it possible to run those tests within my IDE (IDEA/WebStorm) directly, preserving the configuration? I'm not a js guy, but for example WebStrom works perfectly fine with Karma. Shouldn't this be possible with jest-cli either?
To make Jest test results shown in a tree view (like karma, etc.), a special integration is needed. WebStorm doesn't yet support Jest. Please vote for WEB-14979 to be notified on any progress.
EDIT: as of March 2017 the first version of Jest integration at WebStorm has been released.
In WebStorm 9+ You can set this up as follows:
Install Jest CLI: npm install --save-dev jest-cli
Create node run configuration with javascript file set to node_modules/.bin/jest, and application parameter to --runInBand. runInBand tells jest to run in single process, otherwise there's a port conflict when running multiple node processes in debug mode
Create some tests and run configuration in Debug mode (Ctrl-D/CMD-D). If you set breakpoints in your test or app code they should hit
It would be great though if you could click on file:line numbers in the output to go directly to the code.
app_sciences's answer is awesome, but does not work for Windows.
For windows, you can use next configuration:
Provided configuration is taken from here
For IDEA I'm using https://confluence.jetbrains.com/display/IDEADEV/Run+Configurations for that purposes. For WebStorm it seems you can add your config by yourself https://www.jetbrains.com/webstorm/help/creating-and-editing-run-debug-configurations.html . The configuration you are talking about is on the software level. If you will configure to run it via your IDE it will definitely will run within the ENV variables and paths given, you just need to add the needed global paths and the commands to run.