I'm trying to deploy my web app to App Engine in GCP. I have my API key and Client key stored in my app.yaml file. but when I try to deploy my app I'm getting this error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file:
[C:\app.yaml]
Value 'API-KEY' for key in EnvironmentVariables does not match expression '^(?:
[a-zA-Z_][a-zA-Z0-9_]*)$'
in "C:\app.yaml", line 4, column 12
and here is my app.yaml file:
runtime: nodejs
env: flex
env_variables:
API-KEY: 'ExampleAPIKey'
CLIENT_ID: 'example123-clientkey1234567890.apps.googleusercontent.com'
I tried to remove the '' but I got the same error message. I don't know what I'm missing here.
Related
When I try to make a call from my front-end (NextJS) I get the following error Error: Body must be a string. Received: undefined.
I can successfully make a call from my AppSync console, but not from my front-end. I have pushed the following schema.graphql file with amplify push:
type Mutation {
...
cancelCard(input: CancelCardInput!): AWSJSON
#function(name: "myp-service-prod-cancel-stepfunction-lambda")
}
I'm seeing logs in CloudWatch when I trigger the Lambda from the Lambda and AppSync consoles, but something is blocking the calls from my javascript:
import { cancelCard } from "../src/graphql/mutations";
const lambdaResponse = await API.graphql(
graphqlOperation(cancelCard, {
input: { id: cardId },
})
)
The problem was that I had performed amplify codegen configure and updated from javascript to typescript. As a result, Amplify had updated my src/ folder to have .ts files in, but not removed the .js files. This meant that where I had:
src/graphql/
mutations.ts
mutations.js
My app was ignoring the mutations.ts file.
Deleting the js files solved the issue.
Tried to connect firebase realtime database with my android app and updated firebase gradle files, since then this error causes my app to crash, HELP:
2021-06-19 12:47:52.128 23038-23038/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.drowsinessdetection, PID: 23038
java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar)
at com.google.firebase.components.ComponentDiscovery.discoverLazy(ComponentDiscovery.java:112)
at com.google.firebase.FirebaseApp.<init>(FirebaseApp.java:418)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:299)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:267)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:252)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(FirebaseInitProvider.java:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2154)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2128)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(FirebaseInitProvider.java:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:7294)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6765)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6615)
at android.app.ActivityThread.access$1600(ActivityThread.java:232)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1953)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7697)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950
build.gradle(app) config & firebase versions
I am learning how to configure my Node.js App environment. For this I am using config module.
Below is my index.js file:
`
const config=require('config');
const express=require('express');
const app=express();
app.use(express.json()); //BUILT-IN EXPRESS MIDDLEWARE-FUNCTION
//CONFIGURATION
console.log('Current Working Environment:',process.env.NODE_ENV);
console.log('Name is:', config.get('name'));
console.log('Server is:', config.get('mail.host'));
console.log('Password is:', config.get('mail.password'));
`
I set NODE_ENV to production by the power shell command: $env:NODE_ENV="production".
My production.json file inside the config folder is:
`{
"name":"My Productoin Environmet",
"mail":{
"host": "Prod-Environment"
}
}`
And custom-environment-variables.json file is:
`{
"mail":{
"passwrod":"app_password"
}
}`
I set app_password to 12345678 by the power shell command : $env:app_password="12345678"
config.get() is supposed to look at various sources to look for this configurations including, json files, configuration files and also environment variables. But whenever I run my app, I get the following error:
`throw new Error('Configuration property "' + property + '" is not defined'); Error: Configuration property "mail.password" is not defined`
If I remove the line : console.log('Password is:', config.get('mail.password')); everything goes well. Please, guide me what is the solution?
Firstly you have a lot of syntactical errors for example in
custom-environment-variables.json
{
"mail":{
"password":"app_password"
}
}
Now if u need to store the password of your mail server in the environment variables
On windows
$env:app_password=12345
On Linux and OSX:
export app_password=12345
how to run ?
app.js
const config = require("config");
console.log("Mail Password: " + config.get("mail.password"));
i had the same problem because i didn't define an environment variable for storing the password of the mail server. So, my suggestion will be define your environment variable for storing the password using the below command line (mac) and then your code should work.
export app_password=/* the password you want to set */
how to define an environment variable for storing the password of the mail server.
While defining environment variables in command_prompt don't put space on either side of '=' sign.....
eg:
set app_password = 123456 -----> is wrong way
set app_password=123456 -----> will work
The issue in 99% of cases is in the name of the file in the config folder, storing your custom variables
To add on: make sure your file has .json extension.
I am developing an API automated test case using cucumber and JavaScript and I am getting this error:
Error: Parse error in 'test/step_definitions/requester.js': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got '//const fetch = require('node-fetch');'
I have a .feature file within 'features' folder.
In addition, I have two .js files within 'step_definitions' folder. Files are 'my_steps' and 'requester.js'.
The Gruntfile.js contains this line to run it:
command: './node_modules/.bin/cucumber-js /features/*.feature -r /Users/alfredo.bazo/XCore-ContentLibrary-Tests/API-Test/test/step_definitions/*.js',
As per error thrown, it seems that requester.js file is considered as a feature file. Why? How can I fix it?
Thanks in advance.
So I'm getting this in my command terminal when I try to import the following file:
C:\Program Files\MongoDB\Server\3.2\bin>mongoimport --db test --collection horse_data --file horse1.json
2016-02-23T20:31:18.731-0500 connected to: localhost
2016-02-23T20:31:18.736-0500 Failed: error processing document #1: invalid character 'h' in literal Timestamp (expecting 'i')
2016-02-23T20:31:18.743-0500 imported 0 documents
With the following horse1.json file (Which I'm not entirely certain is correctly written, I've got very little experience with JavaScript:
{
_horse_name:"Seabiscuit",
_horse_gender:"Male",
_breed:"Thoroughbred",
_weight:1199,
_date_of_birth:"May 23, 1933",
_sire:"Hard Tack",
_mare:"Swing On",
_auction_price:104260
}
I'm honestly stumped here. Any pointers?