Can I skip generating the {proxy+} when creating Rest API using Amplify - aws-api-gateway

I am currently playing around with creating rest-api:s with amplify. I am trying to create the following structure:
/helloText
/helloText/{name}
But I get the following error when trying to push the backend:
Unable to create resource at path '/helloText/{proxy+}': A sibling ({name}) of this resource already has a variable path part -- only one is allowed
As I understand, it is because Amplify is creating "greedy paths" by default.
When manually removing these "greedy paths" from the template file RestTest-cloudformation-template.json it works.
Is it somehow possible to create these paths by using only the command line?

There is no configuration switch for that in amplify-cli. You need to create an override. Reference: Amplify override api.
Run:
amplify override api
Then edit generated override.ts like:
import { AmplifyApiRestResourceStackTemplate } from '#aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyApiRestResourceStackTemplate) {
const {paths} = resources.restApi.body;
Object.keys(paths).forEach((path) => {
if (path.includes('{proxy+}')) {
delete paths[path];
}
});
}

Related

How to get property from application.property in Gatling

I'm trying to get some properties from an application.properties file in Gatling-Scala. I tried.
val properties: Config = ConfigFactory.load("application.properties")
val clientId: String = properties.getString("api.clientId")
I keep getting "com.typesafe.config.ConfigException$Missing No configuration setting found for key 'api'". I put the application.properties file inside src/test/resources/application.properties and also in the root folder of the project.
I tried also to put the same information inside src/test/resources/gatling.conf as follows:
gatling {
api {
clientId = "..."
}
}
But I get the error:
com.typesafe.config.ConfigException$Missing No configuration setting found for key 'gatling'
Is there something I'm missing?
I managed to get the information in the gatling.conf file by installing the plugin HOCON for .conf files and formatting it correctly.

How do I pass environment configuration like URLs to Flutter application using Jenkins?

I have a Jenkins job that builds my Flutter application based on different parameters like flavor (for different environments), backend URLs, etc. Right now in the build phase, I have a bash script that creates a new dart file based on my parameters and then Flutter uses that file as its environment configuration.
Future<void> main() async {
final config = {
'param1': Platform.environment['param1'],
};
final filename = 'lib/env.dart';
await File(filename)
.writeAsString('final environment = ${json.encode(config)};');
}
Is there a better way to send parameters like URLs from Jenkins to the Flutter application during the build process?
Maybe you must try pass your URLs with environments variables from jenkins to flask app.
In jenkins for example you can create a build stage like this
stage('Build') {
agent {
label 'master'
}
environment {
YOUR_URL = "https://example.com/api/v1"
}
steps {
script {
/* Some actions */
}
}
}
So, in your flask app only just missing get the env variables with any method like os.environ method like this example
import os
YOUR_URL = os.environ.get("YOUR_URL")

Specify injection order of user-defined monitor files in apama_project

Can an apama_project specify the injection order of user-defined types?
It appears the engine_deploy does not automatically resolve the user-defined dependency graph.
Using the apama_project tool, I have setup a project with two *.mon files. 1.mon depends on an event definition in 2.mon.
TestProject
|-.dependencies
...
|-events
|-monitors
| |-1.mon // depends 2.mon
| |-2.mon
|-.project
The intent was to see if the engine_deploy tool could identify the dependency tree of user-defined types. Unfortunately, it does not appear to:
engine_deploy -d ../Deployment .
INFO: copying the project file from /home/twanas/base_project to output directory ../Deployment
WARN: Overwriting output deployment directory ../Deployment
ERROR: Failed to generate initialization list as the project has below error(s):
/home/twanas/base_project/monitors/1.mon: 1: the name rt in the com namespace does not exist
/home/twanas/base_project/monitors/1.mon: 5: "A" does not exist
Full source:
// 1.mon
using com.rt.sub_a;
monitor B {
action onload() {
on all A() as a {
log a.toString();
}
}
}
// 2.mon
package com.rt.sub_a;
event A {
string mystring;
}
Assuming the user is developing on linux so does not use the 'SoftwareAG Designer' - how can this be achieved?
On a separate note - the apama_project and engine_deploy are great additions to toolbase.
The issue was actually caused by invalid EPL using com.rt.sub_a;
The tools did indeed resolve the user-defined dependencies which is excellent.

Sharing a public tree in an ember-cli addon

I am completely puzzled when I read all the information I can gather about sharing a public assets directory from an ember-cli addon.
Is there anybody having it working around here? Any ref to an example addon doing it would also be appreciated...
So... I finally found a way to share the static assets:
- I placed the files in vendor/assets directory
- Declared the files to shared (each file...) into the addon's index.js file # addon's root
app.import('vendor/assets/my_image.png');
An interesting option of app.import statement I found in my searches is destDir, which allows to customize the target publication path of the asset:
app.import('vendor/assets/a/b/c/my_image.png', { destDir: 'x/y' });
will publish my_image.png # URL /assets/x/y/my_image.png
Hoping this will help others to save time...
Assets of addons are available under a namespace. For example if there is a file in public/assets/image.png in your addon, this file is available under /my-addon/assets/image.png.
If you don't want to use a namespace, you can overwrite the treeForPublic hook in the addon definition as demonstrated in this gist:
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: require('./package').name,
treeForPublic: function(tree) {
const assetsTree = new Funnel('public');
return mergeTrees([tree, assetsTree], {
overwrite: true,
});
},
};

Simple auth addon seems to not be reading env config

I am following the example here, and I have this in my config/environment.js file:
ENV['simple-auth'] = {
authorizer: 'simple-auth-authorizer:devise',
routeAfterAuthentication: 'landing-pages'
};
However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library.
I tried importing the configuration in the environment.js file ES6-style, but that doesn't seem possible.
Ember Simple Auth actually still relies on the window.ENV configuration variable, so you'll need to add it to your configuration. Do it like this:
window.MyAppENV = {{ENV}};
+ window.ENV = window.MyAppENV;
window.EmberENV = window.MyAppENV.EmberENV;
When used with the Ember CLI Simple Auth addon, Ember Simple Auth uses the ENV['simple-auth'] configuration set in config/environment.js like below:
...
var ENV = {
...
};
ENV['simple-auth'] = {
routeAfterAuthentication: 'some.route.name.you.choose'
};
...