RuntimeException: E_MISSING_CONFIG Adonis.js - adonis.js

Getting the following error while running the app:
RuntimeException: E_MISSING_CONFIG: logger.transport is not defined inside config/app.js file
Below is the config/app.js file with logger config code (comments have been removed),
logger: {
transport: 'console',
console: {
driver: 'console',
name: 'adonis-app',
level: 'info'
},
file: {
driver: 'file',
name: 'adonis-app',
filename: 'adonis.log',
level: 'info'
}
}
I am still new to adonis and couldn't think of possible issue with this configurations.
Dependencies:
"#adonisjs/ace": "^5.0.1",
"#adonisjs/antl": "^2.0.5",
"#adonisjs/auth": "^3.0.4",
"#adonisjs/bodyparser": "^2.0.2",
"#adonisjs/cors": "^1.0.5",
"#adonisjs/drive": "^1.0.2",
"#adonisjs/fold": "^4.0.7",
"#adonisjs/framework": "^5.0.5",
"#adonisjs/ignitor": "^2.0.8",
"#adonisjs/lucid": "^5.0.3",
"#adonisjs/mail": "^3.0.7",
"#adonisjs/session": "^1.0.23",
"#adonisjs/shield": "^1.0.6",
"#adonisjs/validator": "^5.0.3",
"acler": "^1.0.0",
"adonis-acl": "^1.1.0",
"adonis-scheduler": "^3.0.2",

I know this is has been asked a while ago, but I came across the same issue and couldn't find an answer anywhere.
Anyways, turned out it was caused by HTTPS in my case. For some reason when you run the server in HTTPS mode(as described in their docs) it can no longer run your app/tests if it can't find the SSL key and cert files.
On production this doesn't matter cause it'll be able to find the SSL files, but in my case I was using this with gitlab CI to run tests before deploying it to my remote host. the gitlab CI runner doesn't have the SSL files and thus couldn't run the tests.
I've solved this issue by simply copying server.js to server-ssl.js and making sure I run server.js when testing, and server-ssl.js on my remote host.
server.js contains the default HTTP server configuration, and server-ssl.js contains the HTTPS server configuration.
Hope this helps someone out in the future! ;)
EDIT: This error can also occur when you're trying to load a config option that doesn't exist in any other config file. eg reading from a file that doesn't exist(fs.readFileSync).

Related

Dev Proxy from webpack dev server to flask backend connection refused

I've been working on a react app and I wanted to get hot re-loading going so I set up a webpack dev server. It's working great. It runs on localhost:8080 and the hot re-loading works perfectly.
Great, now I just need to set up a proxy to route requests from 8080 to my flask server running on 5000 right?
Cool so I added a proxy field to my webpack.config.js
27 devServer: {
28 static: './static/dist',
29 proxy: {
30 '/': 'http://localhost:5000',
31 secure:false,
32 }
33 },
But when I re-run npm run start
"start": "webpack serve --open --mode=development"
I get all of these connection refused errors. My flask is up and running fine and I can query the api routes directly and have data be returned.
[webpack-dev-server] [HPM] Error occurred while proxying request localhost:8080/all_users to http://localhost:5000/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors)
I followed the URL and the only advice there was that this error usually occurs when the external system is down. Since mine isn't, I'm pretty confused.
Any help would be greatly appreciated.
I have no idea why but changing 'http://localhost:5000' to 'http://127.0.0.1:5000' solved my problem.
If anyone knows I'd still be curious why this fixed it. I can go to 'http://localhost:5000' in my browser and query my backend just fine.

deploy nuxtjs application to GCP, but it gives server error?

I'm new to GCP (google cloud platform) I'm facing this problem, Backend dev created an Apache server on gcp, and then I cloned my repo on the server through VM, build it and then deployed it after following countless tutorials.. but while deploying it gives
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable.
when i go to the generated link which is https://vetution.oa.r.appspot.com/ it gives server error, I've searched a lot but I failed.
Have I done something wrong or the app.yaml file should have different configurations.
anyway here it is
runtime: nodejs12
instance_class: F2
handlers:
- url: /_nuxt
static_dir: .nuxt/dist/client
secure: always
- url: /(.*\.(gif|png|jpg|ico|txt))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg|ico|txt)$
secure: always
- url: /.*
script: auto
secure: always
env_variables:
HOST: '0.0.0.0'
NODE_ENV: 'production'
And It gives me this error on deploying now
please, Help me I'm very frustrated.
The error states that, your app failed to start because it's not listening to a port as you may not have configure it to your app. This topic is answered on this Stackoverflow thread.
You mentioned that you followed countless tutorials, it is possible that you are using Cloud Run and App Engine interchangeably, which are 2 separate serverless products. Please evaluate on your end which platform is right for your app and use case.
Currently, there is not much debugging info to your question but either way, make sure that you configure your app's port to listen to incoming request/s, it can be port 8080 or can be any of your choice. Also, check your GCP logs, backend issues and server errors can be seen and monitored by simply looking at the logs for App Engine or Cloud Run.
Check Cloud Run configuring the container ports, for port configuration.

Connecting to Google Cloud PostgresSQL Server for local Strapi Application

I have a Google cloud Postgres server set up, and under the production environment I am able to connect to the server correctly. However, when I try to connect to the same cloud server in my local server, it doesn't seem to work. Here's the configuration for my database.js
module.exports = ({ env }) => {
return {
defaultConnection: "default",
connections: {
default: {
connector: "bookshelf",
settings: {
client: "postgres",
host: `/cloudsql/${env("INSTANCE_CONNECTION_NAME")}`,
database: env("DATABASE_NAME"),
username: env("DATABASE_USERNAME"),
password: env("DATABASE_PASSWORD"),
},
options: {},
},
},
};
};
I also have the app.yaml set up as normal. I have also created the .env file to store the relevant env information.
The error I am getting is
error Error: connect ENOENT /cloudsql/my-app-286221:us-central1:blm-resources/.s.PGSQL.5432
Does Strapi in local development support connection to cloud database? Or am I doing something wrong here.
This shouldn’t be a strapi issue. First you need to have an access from outside to google cloud postgres database. I’m not familiar with google cloud services, but from documentation there seem to be a couple of things to do to grant access to database.
More info from documentation:
https://cloud.google.com/sql/docs/postgres/connect-external-app#appaccessIP
Basically you grant access for connection from outside and then you add that connection information to your strapi config file.
I noticed your host: is not pointing to http:// or https:// but to some google server’s local address.

CF : ERR Failed to make TCP connection to port 8080: connection refused

So, I have recently started using CF and am using the same to publish a nodejs app to my cf space.
As suggested in the CF wiki, I have used the nodejs_buildpack to
build my app so that can be run via CF PaaS.
Although I don't need this if I push my own cached
node_modules dependency folder in the CF Space , please correct me if I am wrong ?
Following screenshots represent the output of cf push ,
Output of : CF logs STARS --recent
manifest.yml
---
applications:
- name: STARS
buildpack: nodejs_buildpack
memory: 256m
disk_quota: 512MB
instances: 1
command: npm run build
I don't understand why 8080 fails as this works like charm on my machine. i.e. localhost:8080
I do set the express in the following way though,
app.set('port', process.env.PORT || 8080);
// set up listening
app.listen(port, function (err) {
if (err) {
console.log(err)
} else {
opn('http://localhost:' + app.get('port'))
}
})
--Update--
As suggested by #K.AJ in the answer below I have tried to increase the memory limit in my manifest from 256 to 512 and you know what it started working. :)
But its a little strange that the allocation 179.4M in memory and 206.1M on disk is present. Looks like the addition of these two is considered in the deployment process.
My updated configuration is ,
app.set('port', process.env.PORT || 8080);
In the above statement, the port is 8080, only when running locally.
On cloud platforms like PCF, you have no control on which port an app will be running.
If you look closely to the error message, your app is crashing due to out of memory error. The 256MB memory is not enough for it. Try setting it to 1GB first, get it working and then optimize it.
Assuming, you have successfully deployed your app, run cf apps. It should list you the deployed apps along with the route.
Copy the route url for your app and run it in browser. You should be able to see your app, provided your app instance is healthy and in running state.
Please go through documentation on PCF
https://docs.pivotal.io
https://docs.pivotal.io/pivotalcf/2-3/devguide/index.html
https://docs.pivotal.io/pivotalcf/2-3/devguide/index.html#deploy

How to setup a proxy inside Grunt.js based ember-app-kit?

I need a proxy to interact with some external APIs during development. I fumbled around with grunt-connect-proxy, but beeing a Grunt noobie, i failed getting it to work inside ember-app-kit's Gruntfile or options/connect.js file.
Assuming that needing a proxy in development would be a rather common task, can somebody show an example of how to setup a proxy inside ember-app-kit?
Assuming you have installed grunt-connect-proxy (npm install grunt-connect-proxy --save-dev)
In Gruntfile.js add 'configureProxies' before 'connect:server' in the test:server and server tasks
grunt.registerTask('server', "Run your server in development mode, auto-rebuilding when files change.",
['build:debug', 'configureProxies', 'connect:server', 'watch:main']);
Add the following to taskRequirements in tasks/helpers.js
'connectProxy': ['grunt-connect-proxy']
In tasks/options/connect.js add the proxy settings on the same level as your server settings
// example settings to proxy to a dev server
proxies: [{
context: '/api',
host: 'localhost',
port: 7000,
changeOrigin: true,
rejectUnauthorized: false
}],
In the same file, add the following to require the proxyRequest in the middleware function
if (Helpers.isPackageAvailable("grunt-connect-proxy")) {
result.splice(1,0, require("grunt-connect-proxy/lib/utils").proxyRequest);
}
See https://gist.github.com/jfranz/7034552 for a more complete example.