Why is my settings.json code not working in meteor - meteor

So im really new to meteor, and im trying to deploy my app. So I created a settings.json file and put this code in it:
"galaxy.meteor.com": {
"env": {
"ROOT_URL": "http://<myapp>.meteorapp.com/",
"DEPLOY_HOSTNAME":"galaxy.meteor.com"
"MONGO_URL":"mongodb+srv://abidmir:<password>#cluster0.6fk1x.mongodb.net/Meteor?
retryWrites=true&w=majority"
}
}
but every time i try to deploy it using:
DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy <myapp>.meteorrapp.com --settings
settings.json
I get this message:
Errors prevented deploying:
While preparing to deploy:
settings.json: parse error reading settings file
what am I doing wrong?
Thank you!

This JSON is not valid. A comma is missing after "galaxy.meteor.com", and the whole code needs to be enclosed in curly braces:
{
"galaxy.meteor.com": {
"env": {
"ROOT_URL": "http://<myapp>.meteorapp.com/",
"DEPLOY_HOSTNAME": "galaxy.meteor.com",
"MONGO_URL": "mongodb+srv://abidmir:<password>#cluster0.6fk1x.mongodb.net/Meteor?retryWrites = true & w = majority "
}
}
}

Related

pino-datadog-transport with Next.js on Vercel

I'm trying to migrate a Next.js project running on Vercel from
"pino-datadog": "2.0.2",
"pino-multi-stream": "6.0.0",
to
"pino": "8.4.2",
"pino-datadog-transport": "1.2.2",
and I copy the setup from the pino-datadog-transport's README.md:
import { LoggerOptions, pino } from 'pino'
const pinoConf: LoggerOptions = {
level: 'trace',
}
const logger = pino(
pinoConf,
pino.transport({
target: 'pino-datadog-transport',
options: {
ddClientConf: {
authMethods: {
apiKeyAuth: process.env.DATADOG_API_KEY,
},
},
ddServerConf: {
site: 'datadoghq.eu',
},
service: process.env.VERCEL_URL
ddsource: 'nodejs',
},
}),
)
and this seems to be working fine locally, but when I publish it on Vercel and run it there I get the following error:
ERROR Error: unable to determine transport target for "pino-datadog-transport"
at fixTarget (/var/task/node_modules/pino/lib/transport.js:136:13)
at Function.transport (/var/task/node_modules/pino/lib/transport.js:110:22)
Am I missing some additional config to get this working? Anyone else running this setup or something similar to get explicit logs working on Vercel with Next.js?
I have enabled the Datadog integration in Vercel as well, but that only forwards Next.js logs, not explicit console.logs or standard Pino logs from what I can tell.
The solution to this problem is to import even though nothing in the import is actually used in the code.
It seems Next.js strips away all code that isn't imported when the code is deployed.
So, adding
import 'pino-datadog-transport'
at the top of the file solves the problem.

Vue CLI with electron - Unexpected character (1:0) when using native modules

In some popular NodeJS libraries, e.g. ssh2 or node-pty, there is natively compiled code as part of the library.
Creating the project with
vue create my-project
vue add electron-builder
yarn add ssh2
then importing and using ssh2's Client in the background process results in following errors during
electron:build
ERROR Failed to compile with 1 errors 5:29:10 PM
error in ./node_modules/cpu-features/build/Release/cpufeatures.node
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
# ./node_modules/cpu-features/lib/index.js 1:16-60
# ./node_modules/ssh2/lib/protocol/constants.js
# ./node_modules/ssh2/lib/client.js
# ./node_modules/ssh2/lib/index.js
...
This error occurs with many other libs or transitive dependencies and the reason for it is absence of native-ext-loader on Webpack chain. I understand why it is not included by default, and I would like to see what is the best way to add it.
One solution I found is this:
Add yarn add -D native-ext-loader (my version is 2.3.0 and electron is at 13.x)
Adjust vue.config.js and add the chainWebpackMainProcess like this:
const path = require('path')
module.exports = {
pluginOptions: {
electronBuilder: {
builderOptions: {
// options placed here will be merged with default
mac: {
target: 'dmg',
icon: 'build/icon.icns',
asar: true
}
},
preload: 'src/preload.ts',
chainWebpackMainProcess(config) {
config.module
.rule("node")
.test(/\.node$/)
.use("native-ext-loader")
.loader("native-ext-loader")
.options(
process.env.NODE_ENV === "development"
? {
rewritePath: path.resolve(__dirname, "native"),
}
: {}
)
}
}
}
}
Both, electron:build and electron:serve are now working and ssh2 client is happily delivering the stdout to renderer via ipcMain. Not sure it is the most elegant way of solving it, though.

Azure Functions .NET 5 fails to start after changing value in local settings file

This is a very strange problem and want to see if anyone else can replicate the issue.
I start a brand new Azure Functions app targeting .NET 5. Mine is a timer function but I don't it matters what type of function it is.
I then add a value in my local.settings.json file:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "MY_CONNECTION_STRING_FOR_AZURE_STORAGE",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"MY_APP_ID": "1324"
}
}
}
I modify the Program.cs to read this value:
var host = new HostBuilder()
.ConfigureAppConfiguration(c =>
{
c.AddEnvironmentVariables();
var config = c.Build();
var id = config.GetValue<string>("MY_APP_ID");
})
.ConfigureFunctionsWorkerDefaults()
.Build();
I then run the app and it seems to start up fine.
Then, I modify the local.settings.json file and add a section -- see below:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "MY_CONNECTION_STRING_FOR_AZURE_STORAGE",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"MY_APP_ID": "1324",
"MyApp": {
"MY_APP_ID": "1324"
}
}
}
}
When I try to run the app, I get the following error:
I then remove this section from my local.settings.json file and try running the app again and I get the same error.
It looks like, from this point on, there's nothing I can do to make this app run! If you noticed, I didn't change any code in my Program.cs file. Simply adding a section and removing it from local.settings.json file seems to render the app useless!
Any idea what's going on here?

why copy-from-recipe doesn't add any file to my base project?

I run a local flex server in my local pc (windows) from : https://github.com/moay/server-for-symfony-flex
and I made a recipe with config/routes/api-form-bundle.yaml
and my manifest :
{
"bundles": {
"XXX\\ApiFormBundle\\XXXApiFormBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
"composer-scripts": {
"make:migration": "symfony-cmd"
},
"aliases": ["xxx-apiform", "xxxapiform"]
}
I expect api-form.yaml file added to config/routes directory in my base project after composer install but nothing added. (alias and scripts work without problem)
what is the problem? am I write anything wrong?

sequelize migration not working

I created a migration and ran it. It says it worked fine, but nothing happened. I don't think it is even connecting to my database.
My Migration file:
var util = require("util");
module.exports = {
up : function(migration, DataTypes, done) {
migration.createTable('nameOfTheNewTable', {
attr1 : DataTypes.STRING,
attr2 : DataTypes.INTEGER,
attr3 : {
type : DataTypes.BOOLEAN,
defaultValue : false,
allowNull : false
}
}).success(
function() {
migration.describeTable('nameOfTheNewTable').success(
function(attributes) {
util.puts("nameOfTheNewTable Schema: "
+ JSON.stringify(attributes));
done();
});
});
},
down : function(migration, DataTypes, done) {
// logic for reverting the changes
}
};
My Config.json:
{
"development": {
"username": "user",
"password": "pw",
"database": "my-db",
"dialect" : "sqlite",
"host": "localhost"
}
}
The command:
./node_modules/sequelize/bin/sequelize --migrate --env development
Loaded configuration file "config/config.json".
Using environment "development".
Running migrations...
20130921234513-initial.js
nameOfTheNewTable Schema: {"attr1":{"type":"VARCHAR(255)","allowNull":true,"defaultValue":null},"attr2":{"type":"INTEGER","allowNull":true,"defaultValue":null},"attr3":{"type":"TINYINT(1)","allowNull":false,"defaultValue":false}}
Completed in 8ms
I can run this over and over and the output is always the same. I've tried it on a database which I know to have existing tables and try to describe those tables and still nothing happens.
Am I doing something wrong?
EDIT:
I'm pretty sure I'm not connecting to the db, but try as I might I cannot connect using the migration. I can connect using sqlite3 my-db.sqlite and run commands such as .tables to see tables I have created previously, but I cannot for the life of me get the "nameOfTheNewTable" table created using a migration. (I want to create indexes in the migration too). I have tried using "development", changing values in the config.json like the host, database (my-db, ../my-db, my-db.sqlite), etc.
Here's a good example, in the config.json I put "database" : "bad-db" and the output from the migration is exactly the same. When it is done, there is no bad-db.sqlite file to be found.
You need to specify the 'storage' parameter in your config.json, so that sequelize knows what file to use as the sqlite DB.
Sequelize defaults to using memory storage for sqlite, so it's migrating an in-memory database, then exiting, effectively destroying the DB it just migrated.
you most likely have to wait for migration.createTable to finish:
migration.createTable(/*your options*/).success(function() {
migration.describeTable('nameOfTheNewTable').success(function(attributes) {
util.puts("nameOfTheNewTable Schema: " + JSON.stringify(attributes));
done()
});
})

Resources