Git Product home page Git Product logo

aio-lib-runtime's Introduction

Adobe I/O Runtime Lib

Version Downloads/week Node.js CI License Codecov Coverage

Installing

npm install @adobe/aio-lib-runtime

Usage

  1. Initialize the SDK

    const sdk = require('@adobe/aio-lib-runtime')
    
    async function sdkTest() {
      //initialize sdk. Takes in OpenwhiskOptions
      const client = await sdk.init({ apihost: 'https://adobeioruntime.net', api_key: 'your_auth_key', namespace: 'your_runtime_namespace' })
    }
  2. Call methods using the initialized SDK

    const sdk = require('@adobe/aio-lib-runtime')
    
    async function sdkTest() {
      //initialize sdk. Takes in OpenwhiskOptions
      const client = await sdk.init({ apihost: 'https://adobeioruntime.net', api_key: 'your_auth_key', namespace: 'your_runtime_namespace' })
    
      // call methods
      try {
        // get... something
        const result = await client.getSomething({})
        console.log(result)
    
      } catch (e) {
        console.error(e)
      }
    }

Classes

LogForwarding

Log Forwarding management API

LogForwardingLocalDestinationsProvider

Log Forwarding destination provider

RuntimeAPI

This class provides methods to call your RuntimeAPI APIs. Before calling any method initialize the instance by calling the init method on it with valid options argument

Triggers

Functions

getWebpackConfigPath(actionPath, root)Promise.<string>

Searches for a webpack config file, starting at the action path and working towards the root of the project. Will return the first one it finds.

loadWebpackConfig(configPath, actionPath, tempBuildDir, outBuildFilename)Promise.<object>

Loads a Webpack config file from the config path provided. Sets fields required for Runtime actions. Returns an object that can be passed to the Webpack library.

prepareToBuildAction(action, root, dist)Promise.<ActionBuild>

Will return data about an action ready to be built.

zipActions(buildsList, lastBuildsPath, distFolder, skipCheck)Array.<string>

Will zip actions. By default only actions which were not built before will be zipped. Last built actions data will be used to validate which action needs zipping.

deployActions(config, [deployConfig], [logFunc])Promise.<object>

runs the command

deployWsk(scriptConfig, manifestContent, logFunc, filterEntities)Promise.<object>
init(options)Promise.<OpenwhiskClient>

Returns a Promise that resolves with a new RuntimeAPI object.

printActionLogs(config, logger, limit, filterActions, strip, tail, fetchLogsInterval, startTime)object

Prints action logs.

undeployActions(config, [logFunc])
undeployWsk(packageName, manifestContent, owOptions, logger)Promise.<void>
getIncludesForAction(action)Promise.<Array.<IncludeEntry>>

Gets the list of files matching the patterns defined by action.include

printLogs(activation, strip, logger)

Prints activation logs messages.

printFilteredActionLogs(runtime, logger, limit, filterActions, strip, startTime)object

Filters and prints action logs.

getActionEntryFile(pkgJsonPath)string

returns path to main function as defined in package.json OR default of index.js note: file MUST exist, caller's responsibility, this method will throw if it does not exist

zip(filePath, out, pathInZip)Promise

Zip a file/folder using archiver

createKeyValueObjectFromArray(inputsArray)object

returns key value pairs in an object from the key value array supplied. Used to create parameters object.

createKeyValueArrayFromObject(object)Array

returns key value array from the object supplied.

safeParse(val)object

returns JSON.parse of passed object, but handles exceptions, and numeric strings

createKeyValueArrayFromFlag(flag)Array

returns key value array from the parameters supplied. Used to create --param and --annotation key value pairs

createKeyValueArrayFromFile(file)Array

returns key value array from the json file supplied. Used to create --param-file and annotation-file key value pairs

createKeyValueObjectFromFlag(flag)object

returns key value pairs in an object from the parameters supplied. Used to create --param and --annotation key value pairs

parsePackageName(name)object

parses a package name string and returns the namespace and entity name for a package

getKeyValueArrayFromMergedParameters(params, paramFilePath)Array

returns key value array from the params and/or param-file supplied with more precendence to params.

getKeyValueObjectFromMergedParameters(params, paramFilePath)object

returns key value object from the params and/or param-file supplied with more precendence to params.

createKeyValueObjectFromFile(file)object

returns key value pairs from the parameters supplied. Used to create --param-file and --annotation-file key value pairs

createComponentsFromSequence(sequenceAction)object

Creates an object representation of a sequence.

createComponentsFromSequence(sequenceAction)object
returnUnion(firstObject, secondObject)object

Creates a union of two objects

parsePathPattern(path)Array

Parse a path pattern

processInputs(input, params)object

Process inputs

createKeyValueInput(input)object

Create a key-value object from the input

getDeploymentPath()string

Get the deployment yaml file path

getManifestPath()string

Get the manifest yaml file path

returnDeploymentTriggerInputs(deploymentPackages)object

Get the deployment trigger inputs.

returnAnnotations(action)object

Get the annotations for an action

createApiRoutes(pkg, pkgName, apiName, allowedActions, allowedSequences, pathOnly)Array.<OpenWhiskEntitiesRoute>

Creates an array of route definitions from the given manifest-based package. See https://github.com/apache/openwhisk-wskdeploy/blob/master/parsers/manifest_parser.go#L1187

createSequenceObject(fullName, manifestSequence, packageName)OpenWhiskEntitiesAction

Create a sequence object that is compatible with the OpenWhisk API from a parsed manifest object

checkWebFlags(flag)object

Check the web flags

createActionObject(fullName, manifestAction)OpenWhiskEntitiesAction

Create an action object compatible with the OpenWhisk API from an action object parsed from the manifest.

processPackage(packages, deploymentPackages, deploymentTriggers, params, [namesOnly], [owOptions])OpenWhiskEntities

Process the manifest and deployment content and returns deployment entities.

setPaths(flags)DeploymentFileComponents

Get the deployment file components.

deployPackage(entities, ow, logger, imsOrgId)

Deploy all processed entities: can deploy packages, actions, triggers, rules and apis.

undeployPackage(entities, ow, logger)

Undeploy all processed entities: can undeploy packages, actions, triggers, rules and apis. Entity definitions do not need to be complete, only the names are needed for un-deployment.

syncProject(projectName, manifestPath, manifestContent, entities, ow, logger, imsOrgId, deleteEntities)

Sync a project. This is a higher level function that can be used to sync a local manifest with deployed entities.

syncProject doesn't only deploy entities it might also undeploy entities that are not defined in the manifest. This behavior can be disabled via the deleteEntities boolean parameter.

getProjectEntities(project, isProjectHash, ow)Promise.<OpenWhiskEntities>

Get deployed entities for a managed project. This methods retrieves all the deployed entities for a given project name or project hash. This only works if the project was deployed using the whisk-managed annotation. This annotation can be set pre-deployement using [addManagedProjectAnnotations](#addmanagedprojectannotations).

Note that returned apis will always be empty as they don't support annotations and hence are not managed as part of a project.

addManagedProjectAnnotations(entities, manifestPath, projectName, projectHash)

Add the whisk-managed annotation to processed entities. This is needed for syncing managed projects.

getProjectHash(manifestContent)string

Compute the project hash based on the manifest content string. This is used for syncing managed projects.

findProjectHashOnServer(ow, projectName)Promise.<string>

Retrieve the project hash from a deployed managed project.

findProjectHashOnServer(ow, projectName)Promise.<string>

Retrieve the project hash from a deployed managed project.

_relApp(root, p)string

Path relative to the root

_absApp(root, p)string

Absolute path

checkOpenWhiskCredentials(config)

Checks the existence of required openwhisk credentials

getActionUrls(appConfig, isRemoteDev, isLocalDev, legacy)object

Returns action URLs based on the manifest config

urlJoin(...args)string

Joins url path parts

removeProtocolFromURL(url)string
replacePackagePlaceHolder(config)object
validateActionRuntime(action)

Checks the validity of nodejs version in action definition and throws an error if invalid.

isSupportedActionKind(action)boolean

Checks the validity of nodejs version in action definition returns true if valid.

getActionZipFileName(pkgName, actionName, defaultPkg)string

Returns the action's build file name without the .zip extension

getActionNameFromZipFile(zipFile)string

Returns the action name based on the zipFile name.

activationLogBanner(logFunc, activation, activationLogs)

Creates an info banner for an activation.

actionBuiltBefore(lastBuildsData, buildData)boolean

Will tell if the action was built before based on it's contentHash.

dumpActionsBuiltInfo(lastBuiltActionsPath, actionBuildData, prevBuildData)Promise.<boolean>

Will dump the previously actions built data information.

getSupportedServerRuntimes(apihost)Array.<string>

Gets a list of the supported runtime kinds from the apihost.

Typedefs

ActionBuild : object
OpenwhiskOptions : object
OpenwhiskRetryOptions : object
OpenwhiskClient : object
ManifestPackages : Array.<ManifestPackage>

The entry point to the information read from the manifest, this can be extracted using setPaths.

ManifestPackage : object

The manifest package definition

ManifestAction : object

The manifest action definition

IncludeEntry : object
ManifestSequence : object

The manifest sequence definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_sequences.md

ManifestTrigger : object

The manifest trigger definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_triggers.md

ManifestRule : object

The manifest rule definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_rules.md

ManifestDependency : object

The manifest dependency definition TODO

OpenWhiskEntities : object

The OpenWhisk entities definitions, which are compatible with the openwhisk node client module. Can be obtained using (processpackage)[#processpackage] (with onlyNames=true for un-deployment)

OpenWhiskEntitiesRoute : object

The api entity definition

OpenWhiskEntitiesAction : object

The action entity definition TODO

OpenWhiskEntitiesRule : object

The rule entity definition TODO

OpenWhiskEntitiesTrigger : object

The trigger entity definition TODO

OpenWhiskEntitiesPackage : object

The package entity definition TODO

DeploymentPackages : Array.<object>

The entry point to the information read from the deployment file, this can be extracted using setPaths. TODO

DeploymentFileComponents : object

LogForwarding

Log Forwarding management API

Kind: global class

logForwarding.get() ⇒ Promise.<*>

Get current Log Forwarding settings

Kind: instance method of LogForwarding
Returns: Promise.<*> - response from get API

logForwarding.setAdobeIoRuntime() ⇒ Promise.<(*|undefined)>

Deprecated

Set Log Forwarding to Adobe I/O Runtime (default behavior)

Kind: instance method of LogForwarding
Returns: Promise.<(*|undefined)> - response from set API

logForwarding.setAzureLogAnalytics(customerId, sharedKey, logType) ⇒ Promise.<(*|undefined)>

Deprecated

Set Log Forwarding to Azure Log Analytics

Kind: instance method of LogForwarding
Returns: Promise.<(*|undefined)> - response from set API

Param Type Description
customerId string customer ID
sharedKey string shared key
logType string log type

logForwarding.setSplunkHec(host, port, index, hecToken) ⇒ Promise.<(*|undefined)>

Deprecated

Set Log Forwarding to Splunk HEC

Kind: instance method of LogForwarding
Returns: Promise.<(*|undefined)> - response from set API

Param Type Description
host string host
port string port
index string index
hecToken string hec token

logForwarding.getSupportedDestinations() ⇒ Array.<object>

Get supported destinations

Kind: instance method of LogForwarding
Returns: Array.<object> - in format: { value: , name: }

logForwarding.getDestinationSettings(destination) ⇒ Array.<object>

Get destination settings

Kind: instance method of LogForwarding
Returns: Array.<object> - in format: { name: , message: [, type: ] }

Param Type Description
destination string Destination name

logForwarding.setDestination(destination, config) ⇒ Promise.<*>

Configure destination

Kind: instance method of LogForwarding
Returns: Promise.<*> - response from set API

Param Type Description
destination string Destination name
config object value-pairs of settings, specific to the destination

logForwarding.getErrors() ⇒ object

Get log forwarding errors

Kind: instance method of LogForwarding
Returns: object - Errors in format { destination: '', errors: [] }

LogForwardingLocalDestinationsProvider

Log Forwarding destination provider

Kind: global class

logForwardingLocalDestinationsProvider.getSupportedDestinations() ⇒ Array.<object>

Get supported destinations

Kind: instance method of LogForwardingLocalDestinationsProvider
Returns: Array.<object> - in format: { value: , name: }

logForwardingLocalDestinationsProvider.getDestinationSettings(destination) ⇒ Array.<object>

Get destination settings

Kind: instance method of LogForwardingLocalDestinationsProvider
Returns: Array.<object> - in format: { name: , message: [, type: ] }

Param Type Description
destination string Destination name

RuntimeAPI

This class provides methods to call your RuntimeAPI APIs. Before calling any method initialize the instance by calling the init method on it with valid options argument

Kind: global class

runtimeAPI.init(options) ⇒ Promise.<OpenwhiskClient>

Initializes a RuntimeAPI object and returns it.

Kind: instance method of RuntimeAPI
Returns: Promise.<OpenwhiskClient> - a RuntimeAPI object

Param Type Description
options OpenwhiskOptions options for initialization

Triggers

Kind: global class

new Triggers()

A class to manage triggers

triggers.create(options) ⇒ Promise.<object>

Creates a trigger and associated feeds

Kind: instance method of Triggers
Returns: Promise.<object> - the result of the create operation

Param Type Description
options object input options to create the trigger from manifest

triggers.delete(options) ⇒ Promise.<object>

Deletes a trigger and associated feeds

Kind: instance method of Triggers
Returns: Promise.<object> - the result of the delete operation

Param Type Description
options object options with the name of the trigger

getWebpackConfigPath(actionPath, root) ⇒ Promise.<string>

Searches for a webpack config file, starting at the action path and working towards the root of the project. Will return the first one it finds.

Kind: global function
Returns: Promise.<string> - Webpack config file path, will be 'null' if not found

Param Type Description
actionPath string Path of the action
root string Root of the project

loadWebpackConfig(configPath, actionPath, tempBuildDir, outBuildFilename) ⇒ Promise.<object>

Loads a Webpack config file from the config path provided. Sets fields required for Runtime actions. Returns an object that can be passed to the Webpack library.

Kind: global function
Returns: Promise.<object> - Webpack config, can be passed to the Webpack library

Param Type Description
configPath string Path of the Webpack config file
actionPath string Path of the action
tempBuildDir string Path of the output directory for the bundle
outBuildFilename string Name of the output file for the action

prepareToBuildAction(action, root, dist) ⇒ Promise.<ActionBuild>

Will return data about an action ready to be built.

Kind: global function
Returns: Promise.<ActionBuild> - Relevant data for the zip process..

Param Type Description
action object Data about the Action.
root string root of the project.
dist string Path to the minimized version of the action code

zipActions(buildsList, lastBuildsPath, distFolder, skipCheck) ⇒ Array.<string>

Will zip actions. By default only actions which were not built before will be zipped. Last built actions data will be used to validate which action needs zipping.

Kind: global function
Returns: Array.<string> - Array of zipped actions.

Param Type Description
buildsList Array.<ActionBuild> Array of data about actions available to be zipped.
lastBuildsPath string Path to the last built actions data.
distFolder string Path to the output root.
skipCheck boolean If true, zip all the actions from the buildsList

deployActions(config, [deployConfig], [logFunc]) ⇒ Promise.<object>

runs the command

Kind: global function
Returns: Promise.<object> - deployedEntities

Param Type Default Description
config object app config
[deployConfig] object {} deployment config
[deployConfig.isLocalDev] boolean local dev flag
[deployConfig.filterEntities] object add filters to deploy only specified OpenWhisk entities
[deployConfig.filterEntities.actions] Array filter list of actions to deploy by provided array, e.g. ['name1', ..]
[deployConfig.filterEntities.byBuiltActions] boolean if true, trim actions from the manifest based on the already built actions
[deployConfig.filterEntities.sequences] Array filter list of sequences to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.triggers] Array filter list of triggers to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.rules] Array filter list of rules to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.apis] Array filter list of apis to deploy, e.g. ['name1', ..]
[deployConfig.filterEntities.dependencies] Array filter list of package dependencies to deploy, e.g. ['name1', ..]
[logFunc] object custom logger function

deployWsk(scriptConfig, manifestContent, logFunc, filterEntities) ⇒ Promise.<object>

Kind: global function
Returns: Promise.<object> - deployedEntities

Param Type Description
scriptConfig object config
manifestContent object manifest
logFunc object custom logger function
filterEntities object entities (actions, sequences, triggers, rules etc) to be filtered

deployWsk~_filterOutPackageEntity(pkgName, pkgEntity, filterItems, fullNameCheck) ⇒ object

Kind: inner method of deployWsk
Returns: object - package object containing only the filterItems

Param Type Description
pkgName object name of the package
pkgEntity object package object from the manifest
filterItems object items (actions, sequences, triggers, rules etc) to be filtered
fullNameCheck boolean true if the items are part of packages (actions and sequences)

init(options) ⇒ Promise.<OpenwhiskClient>

Returns a Promise that resolves with a new RuntimeAPI object.

Kind: global function
Returns: Promise.<OpenwhiskClient> - a Promise with a RuntimeAPI object

Param Type Description
options OpenwhiskOptions options for initialization

printActionLogs(config, logger, limit, filterActions, strip, tail, fetchLogsInterval, startTime) ⇒ object

Prints action logs.

Kind: global function
Returns: object - activation timestamp of the last retrieved activation or null

Param Type Default Description
config object openwhisk config
logger object an instance of a logger to emit messages to
limit number maximum number of activations to fetch logs from
filterActions Array array of actions to fetch logs from examples:- ['pkg1/'] = logs of all deployed actions under package pkg1 ['pkg1/action'] = logs of action 'action' under package 'pkg1' [] = logs of all actions in the namespace
strip boolean if true, strips the timestamp which prefixes every log line
tail boolean false if true, logs are fetched continuously
fetchLogsInterval number 10000 number of seconds to wait before fetching logs again when tail is set to true
startTime number time in milliseconds. Only logs after this time will be fetched

undeployActions(config, [logFunc])

Kind: global function

Param Type Description
config object app config
[logFunc] object custom logger function

undeployWsk(packageName, manifestContent, owOptions, logger) ⇒ Promise.<void>

Kind: global function
Returns: Promise.<void> - void

Param Type Description
packageName string name of the package to be undeployed
manifestContent object manifest
owOptions object openwhisk options
logger object custom logger function

getIncludesForAction(action) ⇒ Promise.<Array.<IncludeEntry>>

Gets the list of files matching the patterns defined by action.include

Kind: global function
Returns: Promise.<Array.<IncludeEntry>> - list of files matching the patterns defined by action.include

Param Type Description
action ManifestAction action object from manifest which defines includes

printLogs(activation, strip, logger)

Prints activation logs messages.

Kind: global function

Param Type Description
activation object the activation
strip boolean if true, strips the timestamp which prefixes every log line
logger object an instance of a logger to emit messages to

printFilteredActionLogs(runtime, logger, limit, filterActions, strip, startTime) ⇒ object

Filters and prints action logs.

Kind: global function
Returns: object - activation timestamp of the last retrieved activation or null

Param Type Default Description
runtime object runtime (openwhisk) object
logger object an instance of a logger to emit messages to (may optionally provide logFunc and bannerFunc to customize logging)
limit number maximum number of activations to fetch logs from
filterActions Array array of actions to fetch logs from ['pkg1/'] = logs of all deployed actions under package pkg1 ['pkg1/action'] = logs of action 'action' under package 'pkg1' [] = logs of all actions in the namespace
strip boolean false if true, strips the timestamp which prefixes every log line
startTime number 0 time in milliseconds. Only logs after this time will be fetched

printFilteredActionLogs~isSequenceActivation(activation) ⇒ boolean

Check if an activation entry is for a sequence.

Kind: inner method of printFilteredActionLogs
Returns: boolean - isSequenceActivation

Param Type Description
activation * activation log entry

printFilteredActionLogs~printActivationLogs(activation, runtime)

Print activation logs

Kind: inner method of printFilteredActionLogs

Param Type Description
activation object activation object
runtime object runtime object

printFilteredActionLogs~printSequenceLogs(activation, runtime)

Print sequence logs

Kind: inner method of printFilteredActionLogs

Param Type Description
activation object sequence activation
runtime object runtime object

printFilteredActionLogs~printLogs(activation, runtime)

Print logs

Kind: inner method of printFilteredActionLogs

Param Type Description
activation object activation
runtime object runtime

getActionEntryFile(pkgJsonPath) ⇒ string

returns path to main function as defined in package.json OR default of index.js note: file MUST exist, caller's responsibility, this method will throw if it does not exist

Kind: global function
Returns: string - path to the entry file

Param Type Description
pkgJsonPath string : path to a package.json file

zip(filePath, out, pathInZip) ⇒ Promise

Zip a file/folder using archiver

Kind: global function
Returns: Promise - returns with a blank promise when done

Param Type Default Description
filePath string path of file.folder to zip
out string output path
pathInZip boolean false internal path in zip

createKeyValueObjectFromArray(inputsArray) ⇒ object

returns key value pairs in an object from the key value array supplied. Used to create parameters object.

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

Param Type Description
inputsArray Array Array in the form of [{'key':'key1', 'value': 'value1'}]

createKeyValueArrayFromObject(object) ⇒ Array

returns key value array from the object supplied.

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

Param Type Description
object object JSON object

safeParse(val) ⇒ object

returns JSON.parse of passed object, but handles exceptions, and numeric strings

Kind: global function
Returns: object - the parsed object

Param Type Description
val string value to parse

createKeyValueArrayFromFlag(flag) ⇒ Array

returns key value array from the parameters supplied. Used to create --param and --annotation key value pairs

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

Param Type Description
flag Array value from flags.param or flags.annotation

createKeyValueArrayFromFile(file) ⇒ Array

returns key value array from the json file supplied. Used to create --param-file and annotation-file key value pairs

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

Param Type Description
file string from flags['param-file'] or flags['annotation-file]

createKeyValueObjectFromFlag(flag) ⇒ object

returns key value pairs in an object from the parameters supplied. Used to create --param and --annotation key value pairs

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

Param Type Description
flag Array from flags.param or flags.annotation

parsePackageName(name) ⇒ object

parses a package name string and returns the namespace and entity name for a package

Kind: global function
Returns: object - An object { namespace: string, name: string }

Param Type Description
name string package name

getKeyValueArrayFromMergedParameters(params, paramFilePath) ⇒ Array

returns key value array from the params and/or param-file supplied with more precendence to params.

Kind: global function
Returns: Array - An array of key value pairs in this format : [{key : 'Your key 1' , value: 'Your value 1'}, {key : 'Your key 2' , value: 'Your value 2'} ]

Param Type Description
params Array from flags.param or flags.annotation
paramFilePath string from flags['param-file'] or flags['annotation-file']

getKeyValueObjectFromMergedParameters(params, paramFilePath) ⇒ object

returns key value object from the params and/or param-file supplied with more precendence to params.

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

Param Type Description
params Array from flags.param or flags.annotation
paramFilePath string from flags['param-file'] or flags['annotation-file']

createKeyValueObjectFromFile(file) ⇒ object

returns key value pairs from the parameters supplied. Used to create --param-file and --annotation-file key value pairs

Kind: global function
Returns: object - An object of key value pairs in this format : {Your key1 : 'Your Value 1' , Your key2: 'Your value 2'}

Param Type Description
file string from flags['param-file'] or flags['annotation-file']

createComponentsFromSequence(sequenceAction) ⇒ object

Creates an object representation of a sequence.

Kind: global function
Returns: object - the object representation of the sequence

Param Type Description
sequenceAction Array the sequence action array

createComponentsFromSequence(sequenceAction) ⇒ object

Deprecated

Kind: global function
Returns: object - the object representation of the sequence

Param Type Description
sequenceAction Array the sequence action array

returnUnion(firstObject, secondObject) ⇒ object

Creates a union of two objects

Kind: global function
Returns: object - the union of both objects

Param Type Description
firstObject object the object to merge into
secondObject object the object to merge from

parsePathPattern(path) ⇒ Array

Parse a path pattern

Kind: global function
Returns: Array - array of matches

Param Type Description
path string the path to parse

processInputs(input, params) ⇒ object

Process inputs

Kind: global function
Returns: object - the processed inputs

Param Type Description
input object the input object to process
params object the parameters for the input to process

createKeyValueInput(input) ⇒ object

Create a key-value object from the input

Kind: global function
Returns: object - the processed input as a key-value object

Param Type Description
input object the input to process

getDeploymentPath() ⇒ string

Get the deployment yaml file path

Kind: global function
Returns: string - the deployment yaml path

getManifestPath() ⇒ string

Get the manifest yaml file path

Kind: global function
Returns: string - the manifest yaml path

returnDeploymentTriggerInputs(deploymentPackages) ⇒ object

Get the deployment trigger inputs.

Kind: global function
Returns: object - the deployment trigger inputs

Param Type Description
deploymentPackages DeploymentPackages the deployment packages

returnAnnotations(action) ⇒ object

Get the annotations for an action

Kind: global function
Returns: object - the action annotation entities

Param Type Description
action ManifestAction the action manifest object

createApiRoutes(pkg, pkgName, apiName, allowedActions, allowedSequences, pathOnly) ⇒ Array.<OpenWhiskEntitiesRoute>

Creates an array of route definitions from the given manifest-based package. See https://github.com/apache/openwhisk-wskdeploy/blob/master/parsers/manifest_parser.go#L1187

Kind: global function
Returns: Array.<OpenWhiskEntitiesRoute> - the array of route entities

Param Type Description
pkg ManifestPackage The package definition from the manifest.
pkgName string The name of the package.
apiName string The name of the HTTP API definition from the manifest.
allowedActions Array List of action names allowed to be used in routes.
allowedSequences Array List of sequence names allowed to be used in routes.
pathOnly boolean Skip action, method and response type in route definitions.

createSequenceObject(fullName, manifestSequence, packageName) ⇒ OpenWhiskEntitiesAction

Create a sequence object that is compatible with the OpenWhisk API from a parsed manifest object

Kind: global function
Returns: OpenWhiskEntitiesAction - a sequence object describing the action entity

Param Type Description
fullName string the full sequence name prefixed with the package, e.g. pkg/sequence
manifestSequence ManifestSequence a sequence object as defined in a valid manifest file
packageName string the package name of the sequence, which will be set to for actions in the sequence

checkWebFlags(flag) ⇒ object

Check the web flags

Kind: global function
Returns: object - object with the appropriate web flags for an action

Param Type Description
flag string | boolean the flag to check

createActionObject(fullName, manifestAction) ⇒ OpenWhiskEntitiesAction

Create an action object compatible with the OpenWhisk API from an action object parsed from the manifest.

Kind: global function
Returns: OpenWhiskEntitiesAction - the action entity object

Param Type Description
fullName string the full action name prefixed with the package, e.g. pkg/action
manifestAction ManifestAction the action object as parsed from the manifest

processPackage(packages, deploymentPackages, deploymentTriggers, params, [namesOnly], [owOptions]) ⇒ OpenWhiskEntities

Process the manifest and deployment content and returns deployment entities.

Kind: global function
Returns: OpenWhiskEntities - deployment entities

Param Type Default Description
packages ManifestPackages the manifest packages
deploymentPackages DeploymentPackages the deployment packages
deploymentTriggers object the deployment triggers
params object the package params
[namesOnly] boolean false if false, set the namespaces as well
[owOptions] object {} additional OpenWhisk options

setPaths(flags) ⇒ DeploymentFileComponents

Get the deployment file components.

Kind: global function
Returns: DeploymentFileComponents - fileComponents

Param Type Description
flags object (manifest + deployment)

deployPackage(entities, ow, logger, imsOrgId)

Deploy all processed entities: can deploy packages, actions, triggers, rules and apis.

Kind: global function

Param Type Description
entities OpenWhiskEntitiesAction the processed entities
ow object the OpenWhisk client
logger object the logger
imsOrgId string the IMS Org ID

undeployPackage(entities, ow, logger)

Undeploy all processed entities: can undeploy packages, actions, triggers, rules and apis. Entity definitions do not need to be complete, only the names are needed for un-deployment.

Kind: global function

Param Type Description
entities object the processed entities, only names are enough for undeploy
ow object the OpenWhisk object
logger object the logger

syncProject(projectName, manifestPath, manifestContent, entities, ow, logger, imsOrgId, deleteEntities)

Sync a project. This is a higher level function that can be used to sync a local manifest with deployed entities.

syncProject doesn't only deploy entities it might also undeploy entities that are not defined in the manifest. This behavior can be disabled via the deleteEntities boolean parameter.

Kind: global function

Param Type Default Description
projectName string the project name
manifestPath string the manifest path
manifestContent string the manifest content, needed to compute hash
entities OpenWhiskEntities the entities, extracted via processPackage
ow object the OpenWhisk object
logger object the logger
imsOrgId string the IMS Org ID
deleteEntities boolean true set to true to delete entities

getProjectEntities(project, isProjectHash, ow) ⇒ Promise.<OpenWhiskEntities>

Get deployed entities for a managed project. This methods retrieves all the deployed entities for a given project name or project hash. This only works if the project was deployed using the whisk-managed annotation. This annotation can be set pre-deployement using [addManagedProjectAnnotations](#addmanagedprojectannotations).

Note that returned apis will always be empty as they don't support annotations and hence are not managed as part of a project.

Kind: global function
Returns: Promise.<OpenWhiskEntities> - the deployed project entities

Param Type Description
project string the project name or hash
isProjectHash boolean set to true if the project is a hash, and not the name
ow object the OpenWhisk client object

addManagedProjectAnnotations(entities, manifestPath, projectName, projectHash)

Add the whisk-managed annotation to processed entities. This is needed for syncing managed projects.

Kind: global function

Param Type Description
entities OpenWhiskEntities the processed entities
manifestPath string the manifest path
projectName string the project name
projectHash string the project hash

getProjectHash(manifestContent) ⇒ string

Compute the project hash based on the manifest content string. This is used for syncing managed projects.

Kind: global function
Returns: string - the project hash

Param Type Description
manifestContent string the manifest content

findProjectHashOnServer(ow, projectName) ⇒ Promise.<string>

Retrieve the project hash from a deployed managed project.

Kind: global function
Returns: Promise.<string> - the project hash, or '' if not found

Param Type Description
ow object the OpenWhisk client object
projectName string the project name

findProjectHashOnServer(ow, projectName) ⇒ Promise.<string>

Deprecated

Retrieve the project hash from a deployed managed project.

Kind: global function
Returns: Promise.<string> - the project hash, or '' if not found

Param Type Description
ow object the OpenWhisk client object
projectName string the project name

_relApp(root, p) ⇒ string

Path relative to the root

Kind: global function
Returns: string - relative path

Param Type Description
root string root path
p string path

_absApp(root, p) ⇒ string

Absolute path

Kind: global function
Returns: string - absolute path

Param Type Description
root string root path
p string path

checkOpenWhiskCredentials(config)

Checks the existence of required openwhisk credentials

Kind: global function

Param Type Description
config object openwhisk config

getActionUrls(appConfig, isRemoteDev, isLocalDev, legacy) ⇒ object

Returns action URLs based on the manifest config

Kind: global function
Returns: object - urls of actions

Param Type Default Description
appConfig object app config
isRemoteDev boolean false remote dev
isLocalDev boolean false local dev
legacy boolean false default false add backwards compatibility for urls keys.

urlJoin(...args) ⇒ string

Joins url path parts

Kind: global function
Returns: string - joined url

Param Type Description
...args string url parts

removeProtocolFromURL(url) ⇒ string

Kind: global function
Returns: string - url

Param Type Description
url string url

replacePackagePlaceHolder(config) ⇒ object

Kind: global function
Returns: object - sanitized config

Param Type Description
config object config

validateActionRuntime(action)

Deprecated

Checks the validity of nodejs version in action definition and throws an error if invalid.

Kind: global function

Param Type Description
action object action object

isSupportedActionKind(action) ⇒ boolean

Checks the validity of nodejs version in action definition returns true if valid.

Kind: global function
Returns: boolean - true if action kind is supported

Param Type Description
action object action object

getActionZipFileName(pkgName, actionName, defaultPkg) ⇒ string

Returns the action's build file name without the .zip extension

Kind: global function
Returns: string - name of zip file for the action contents

Param Type Description
pkgName string name of the package
actionName string name of the action
defaultPkg boolean true if pkgName is the default/first package

getActionNameFromZipFile(zipFile) ⇒ string

Returns the action name based on the zipFile name.

Kind: global function
Returns: string - name of the action or empty string.

Param Type Description
zipFile string name of the zip file

activationLogBanner(logFunc, activation, activationLogs)

Creates an info banner for an activation.

Kind: global function

Param Type Description
logFunc object custom logger function
activation object activation metadata
activationLogs Array.<string> the logs of the activation (may selectively suppress banner if there are no log lines)

actionBuiltBefore(lastBuildsData, buildData) ⇒ boolean

Will tell if the action was built before based on it's contentHash.

Kind: global function
Returns: boolean - true if the action was built before

Param Type Description
lastBuildsData string Data with the last builds
buildData object Object where key is the name of the action and value is its contentHash

dumpActionsBuiltInfo(lastBuiltActionsPath, actionBuildData, prevBuildData) ⇒ Promise.<boolean>

Will dump the previously actions built data information.

Kind: global function
Returns: Promise.<boolean> - If the contentHash already belongs to the deploymentLogs file

Param Type Description
lastBuiltActionsPath string Path to the deployments logs
actionBuildData object Object which contains action name and contentHash.
prevBuildData object Object which contains info about all the previously built actions

getSupportedServerRuntimes(apihost) ⇒ Array.<string>

Gets a list of the supported runtime kinds from the apihost.

Kind: global function
Returns: Array.<string> - a list of runtime kinds supported by the runtime apihost

Param Type Description
apihost string the URL of the runtime apihost

ActionBuild : object

Kind: global typedef
Properties

Name Type Description
actionName string The name of the action
buildHash object Map with key as the name of the action and value its contentHash
legacy boolean Indicate legacy action support
tempBuildDir string path of temp build
tempActionName string name of the action file.
outPath string zip output path

OpenwhiskOptions : object

Kind: global typedef
Properties

Name Type Description
apihost string Hostname and optional port for openwhisk platform
api_key string Authorisation key
[api] string Full API URL
[apiversion] string Api version
[namespace] string Namespace for resource requests
[ignore_certs] boolean Turns off server SSL/TLS certificate verification
[key] string Client key to use when connecting to the apihost
[retry] OpenwhiskRetryOptions the retry options. Defaults to 2 retries, with a 200ms minTimeout.

OpenwhiskRetryOptions : object

Kind: global typedef
Properties

Name Type Description
retries number the number of retries for an OpenWhisk call
minTimeout number the minimum number of milliseconds to wait before a retry

OpenwhiskClient : object

Kind: global typedef
Properties

Name Type Description
actions ow.Actions actions
activations ow.Activations activations
namespaces ow.Namespaces namespaces
packages ow.Packages packages
rules ow.Rules rules
triggers ow.Triggers triggers
routes ow.Routes routes
logForwarding LogForwarding Log Forwarding management API

ManifestPackages : Array.<ManifestPackage>

The entry point to the information read from the manifest, this can be extracted using setPaths.

Kind: global typedef

ManifestPackage : object

The manifest package definition

Kind: global typedef
Properties

Name Type Description
version string the manifest package version
[license] string the manifest package license, e.g. Apache-2.0
[actions] Array.<ManifestAction> Actions in the manifest package
[sequences] Array.<ManifestSequence> Sequences in the manifest package
[triggers] Array.<ManifestTrigger> Triggers in the manifest package
[rules] Array.<ManifestRule> Rules in the manifest package
[dependencies] Array.<ManifestDependency> Dependencies in the manifest package
[apis] Array.<object> Apis in the manifest package

ManifestAction : object

The manifest action definition

Kind: global typedef
Properties

Name Type Description
[version] string the manifest action version
function string the path to the action code
runtime string the runtime environment or kind in which the action executes, e.g. 'nodejs:18'
[main] string the entry point to the function
[inputs] object the list of action default parameters
[limits] Array.<object> limits for the action
[web] string indicate if an action should be exported as web, can take the value of: true
[web-export] string same as web
[raw-http] boolean indicate if an action should be exported as raw web action, this option is only valid if web or web-export is set to true
[docker] string the docker container to run the action into
[annotations] Array.<object> the manifest action annotations

IncludeEntry : object

Kind: global typedef
Properties

Name Type Description
dest string destination for included files
sources Array list of files that matched pattern

ManifestSequence : object

The manifest sequence definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_sequences.md

Kind: global typedef
Properties

Name Type Description
actions string Comma separated list of actions in the sequence

ManifestTrigger : object

The manifest trigger definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_triggers.md

Kind: global typedef
Properties

Name Type Description
[inputs] object inputs like cron and trigger_payload
[feed] string feed associated with the trigger.
[annotations] object annotations

ManifestRule : object

The manifest rule definition TODO: see https://github.com/apache/openwhisk-wskdeploy/blob/master/specification/html/spec_rules.md

Kind: global typedef
Properties

Name Type Description
trigger string trigger name
action string action name

ManifestDependency : object

The manifest dependency definition TODO

Kind: global typedef
Properties

Name Type Description
location string package to bind to
[inputs] object package parameters

OpenWhiskEntities : object

The OpenWhisk entities definitions, which are compatible with the openwhisk node client module. Can be obtained using (processpackage)[#processpackage] (with onlyNames=true for un-deployment)

Kind: global typedef
Properties

Name Type Description
apis Array.<OpenWhiskEntitiesRoute> the array of route entities
actions Array.<OpenWhiskEntitiesAction> the array of action entities
triggers Array.<OpenWhiskEntitiesTrigger> the array of trigger entities
rules Array.<OpenWhiskEntitiesRule> the array of rule entities
pkgAndDeps Array.<OpenWhiskEntitiesPackage> the array of package entities

OpenWhiskEntitiesRoute : object

The api entity definition

Kind: global typedef
Properties

Name Type Description
name string the api name
basepath string the api basepath
relpath string the api relpath
action string the action name behind the api
responsettype string the response type, e.g. 'json'
operation string the http method, e.g 'get'

OpenWhiskEntitiesAction : object

The action entity definition TODO

Kind: global typedef
Properties

Name Type Description
action string blank
name string name
exec object exec object

OpenWhiskEntitiesRule : object

The rule entity definition TODO

Kind: global typedef
Properties

Name Type Description
trigger string trigger name
action string action name

OpenWhiskEntitiesTrigger : object

The trigger entity definition TODO

Kind: global typedef
Properties

Name Type Description
[feed] string feed associated with the trigger
[annotations] object annotations
[parameters] object parameters

OpenWhiskEntitiesPackage : object

The package entity definition TODO

Kind: global typedef
Properties

Name Type Description
[publish] boolean true for shared package
[parameters] object parameters

DeploymentPackages : Array.<object>

The entry point to the information read from the deployment file, this can be extracted using setPaths. TODO

Kind: global typedef

DeploymentFileComponents : object

Kind: global typedef
Properties

Name Type Description
packages ManifestPackages Packages in the manifest
deploymentTriggers object Trigger names and their inputs in the deployment manifest
deploymentPackages DeploymentPackages Packages in the deployment manifest
manifestPath string Path to manifest
manifestContent object Parsed manifest object
projectName string Name of the project

Insecure Connection

NODE_TLS_REJECT_UNAUTHORIZED=0 <your_call_here>

Prepend the NODE_TLS_REJECT_UNAUTHORIZED environment variable and 0 value to the call that invokes your function, on the command line. This will ignore any certificate errors when connecting to the Openwhisk server. Usage of this is not recommended, but may be necessary in certain corporate environments.

Debug Logs

LOG_LEVEL=debug <your_call_here>

Prepend the LOG_LEVEL environment variable and debug value to the call that invokes your function, on the command line. This should output a lot of debug data for your SDK calls.

Contributing

Contributions are welcome! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

aio-lib-runtime's People

Contributors

amulyakashyap09 avatar arjuncooliitr avatar buskamuza avatar dependabot[bot] avatar fe-lix- avatar florind12 avatar gjmarques avatar himavanth avatar hparra avatar michaelgoberling avatar moritzraho avatar purplecabbage avatar rabbah avatar sandeep-paliwal avatar shazron avatar visiongeist avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aio-lib-runtime's Issues

Support .env vars in annotations

Per Whisk documentation (https://github.com/apache/openwhisk/blob/master/docs/annotations.md#annotations-specific-to-web-actions) and Adobe documentation (https://developer.adobe.com/runtime/docs/guides/using/securing_web_actions/) OpenWhisk has the ability to secure a web action behind a specified header value. When the header value is placed in the .env file the expectation is that the require-whisk-auth variable will be populated with the environment variable value however this is not happening

Expected Behaviour

require-whisk-auth value is that of the specified .env variable

Actual Behaviour

$auth_hash is not replaced with the actual value so the require-whisk-auth variable ends up having a value of '$auth_hash'
image

Reproduce Scenario (including but not limited to)

Within a web action annotations add value
require-whisk-auth: $auth_hash

Within .env add auth_hash=my_value

Platform and Version

Latest

Log Forwarding management API

Expected Behaviour

This is a feature request.
Add Log Forwarding API that would allow to manage Log Forwarding for the namespace utilizing new adobeioruntime.net API.
This is required for adobe/aio-cli-plugin-runtime#247

The implementation is intentionally separated from OpenWhisk as much as possible. Though the API utilizes same OW credentials, the API itself is a separate feature and does not depend on OW.

Memory Limit Configuration

Expected Behaviour

When configurating an action memory limit in app.config.yaml as such :

application:
  actions: actions
  web: web-src
  runtimeManifest:
    packages:
      mypackage:
        actions:
          myactions:
            function: actions/myaction.js
            runtime: 'nodejs:14'
            limits:
              memory: 512

The memory limit is not taken into account and the default of 256 is being used.

Actual Behaviour

The memory limit from app.config.yaml should be used.

Platform and Version

All platform, aio-cli:8.3.0, @adobe/aio-cli-plugin-runtime:5.4.0 and @adobe/aio-lib-runtime:4.0.0

Sample Code that illustrates the problem

The problem seems to be here

memory: manifestAction.limits.memorySize || 256,

The documentation one two states everywhere we should be using memory when the code uses memorySize.

env vars with dashes in the name are not processed properly

Repro:

  1. add AIO_ims_contexts_cred-entp1675766817381_technical__account__id=my-tech-account-id in .env
  2. Refer to it as a runtime action input: MY_TECH_ID: $AIO_ims_contexts_cred-entp1675766817381_technical__account__id

Expected:

The value of MY_TECH_ID should be my-tech-account-id

Actual:

The value of MY_TECH_ID is -entp1675766817381_technical__account__id

Failing unit test

 FAIL  test/utils.test.js
  ● processInputs › nested input and params

    expect(received).toStrictEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

    @@ -7,7 +7,7 @@
            "extraNested": "itWorks, itWorks, fooo",
          },
        },
        "foo": "itWorks",
        "stuff": "barVar barVar, barVar, fooo",
    -   "techId": "my-tech-account-id",
    +   "techId": "-entp1675766817381_technical__account__id",
      }

      254 |     }
      255 |     const res = utils.processInputs(input, { a: 123 })
    > 256 |     expect(res).toStrictEqual(expectedOutput)
          |                 ^
      257 |     delete process.env.BAR
      258 |     delete process.env.BAR_VAR
      259 |     delete process.env.FOO

      at Object.toStrictEqual (test/utils.test.js:256:17)

feature: enhance formatting for log banner

Expected Behaviour

This is a feature request.

The print log function currently does not emit the banner if the activation has no logs.
Additionally, it can be hard to spot the activation separator.

As an enhancement, I adapted the log formatting to use chalk to emit a header in bold, and additionally, to always print the banner (even if logs are empty). Additionally, I emit some more metadata about the activation in the banner.

Screen Shot 2021-01-25 at 11 51 43 PM

Sample Code that illustrates the problem

The least intrusive implementation option is to allow for caller to specify their own banner generation. Here's the proposed patch from my fork. The feature is implemented on this branch: https://github.com/adobe/aio-lib-runtime/compare/master...rabbah:log-banner?expand=1.

diff --git a/src/utils.js b/src/utils.js
index 895dade..e5db122 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -335,12 +335,21 @@ async function printFilteredActionLogs (runtime, logger, limit, filterActions =
         // results = await runtime.activations.get({ activationId: activation.activationId })
         continue
       }
-      if (results.logs.length > 0) {
+
+      // If logger provides a banner utility, delegate to it.
+      // Otherwise, use default banner and emit only if logs are present
+      if (logFunc.makeBanner) {
+        const banner = logFunc.makeBanner(activation, results.logs.length)
+        if (banner) logFunc(banner)
+      } else if (results.logs.length > 0) {
         activation.annotations.forEach((annotation) => {
           if (annotation.key === 'path') {
             logFunc(annotation.value + ':' + activation.activationId)
           }
         })
+      }
+
+      if (results.logs.length > 0) {

Where the makeBanner interface could be:

/**
 * Creates an info banner for an activation.
 *
 * @param {Activation} activation metadata
 * @param {String[]} activationLogs the logs of the activation (may selectively suppress banner if there are no log lines)
 * @returns banner string or falsy if no banner is desired
 */
(activation, activationLogs) => String|falsy

Rules not in the manifest file are not deleted with undeploy command

When a user runs the command aio app undeploy, all deployed resources on Runtime would be cleaned up regardless whether they are defined in the manifest yaml file or not. However it does not apply to rules, which still rely on the manifest definition.

const manifestEntities = utils.processPackage(manifestContent.packages, {}, {}, {}, true)
entities.apis = manifestEntities.apis
entities.rules = manifestEntities.rules

Reported by @UrsBoller in Firefly Forum: https://experienceleaguecommunities.adobe.com/t5/project-firefly-questions/quot-aio-app-undeploy-quot-error-when-manifest-yaml-changed/qaq-p/379941.

Changes to output config.json have broken projects

We used to export the actions to config.json as

{
    "file-list": "https://[NAMESPACE].adobeioruntime.net/api/v1/web/aioappstash-0.0.1/file-list",
    "file-get": " ....
   ...
}

Now we are prefixing with the package name:

{
    "aioappstash-0.0.1/file-list": "https://[NAMESPACE].adobeioruntime.net/api/v1/web/aioappstash-0.0.1/file-list",
    "aioappstash-0.0.1/file-get": " ....
   ...
}
import actions from '../config.json'
...
actionWebInvoke(actions['file-list'], headers, params)
// this will now fail with undefined

This is the same issue reported by @surajpindoria in slack ...

undeployActions does not have equivalent filterEntities option that is in deployActions

Repro

Sample Code:

await sdk.deployActions(config, { filterEntities: { actions: ['myAction'] } })
await sdk.undeployActions(config)

For example, if you have a rule for an action called myAction, it will not be be deployed when setting filterEntities above. When you go to undeploy actions with the same config, it will error out since it will try to undeploy the rule that was never deployed.

Expected

You can specify the same filterEntities that you used for deployActions, in undeployActions.

Actual

You cannot specify the same filterEntities that you used for deployActions, in undeployActions, resulting in an undeploy error.

Likely flag parsing error when large numeric values

This is a placeholder until I test this fully (unless someone else wants to), but I received a bug report on the copy of createKeyValueObjectFromFlag I have in aio-cli-plugin-cloudmanager. Although that code moved from aio-cli-plugin-runtime to this project, it seems to still be the same.

Expected Behaviour

createKeyValueObjectFromFlag(['foo', '4566206088344615922'])

should return

{ 'foo' : '4566206088344615922' }

Actual Behaviour

It returns

{ 'foo' : 4566206088344616000 }

So there's two problems -- a generic problem where numeric values are returned as numbers, not strings and a specific "large number" problem where some large numbers result in a different problem.

I did a hacky fix to unblock someone in aio-cli-plugin-cloudmanager https://github.com/adobe/aio-cli-plugin-cloudmanager/pull/254/files#diff-eb63176ac949781c5f148f8fa793376af1d1984151f56bd84631f9e8320f29b7R77

Will think some more about a better solution. But I also wanted to create this issue because, AFAICT, aio-lib-runtime has the same problem.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

webpack config is not reloaded when edited during `aio app run`

Expected

The webpack config is reloaded for building the action when edited during aio app run

Actual

The webpack config is not reloaded for building the action when edited during aio app run

Repro

  1. Add a actions/webpack-config.js file, exporting a CommonJS module as a webpack config
  2. Run DEBUG=@adobe/aio-lib-runtime:action-builder:debug aio app run
  3. See the log of the web pack config being loaded
  4. Wait until the 2 urls of your deployed application is logged
  5. Edit actions/webpack-config.js with a new entry/delete an entry
  6. See the log of the web pack config being loaded, it should be different

More detailed logging for Webpack config

Expected Behaviour

As a developer, clear understanding of whether my webpack config file was included or not (due to a typo in the file name or wrong file location).
When running DEBUG=@adobe/aio-lib-runtime app build, in addition to the merged webpack config, I'd like to see:

  1. which locations were searched for webpack config
  2. where it was or was not found
  3. what file name was searched for

Actual Behaviour

I can see only final merged config, but can't understand why it doesn't include my custom webpack config.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Run DEBUG=@adobe/aio-lib-runtime app build

Platform and Version

Any

Sample Code that illustrates the problem

Logs taken while reproducing problem

e2e test should be a unit test

This is needed because a regression happened when the unit tests all passed but the e2e test failed, for a PR. There doesn't seem to be a compelling reason this is a e2e test.

See

describe('build-actions', () => {
test('full config', async () => {
/* skip checking previously built actions */
utils.dumpActionsBuiltInfo = jest.fn(() => false)
utils.actionBuiltBefore = jest.fn(() => false)
expect(await sdk.buildActions(config)).toEqual(expect.arrayContaining([
expect.stringContaining('action.zip'),
expect.stringContaining('action-zip.zip')
]))
expect(fs.readdirSync(path.resolve(config.actions.dist, 'sample-app-1.0.0'))).toEqual(expect.arrayContaining(['action-temp', 'action-zip-temp', 'action-zip.zip', 'action.zip']))
fs.emptydirSync(config.actions.dist)
fs.rmdirSync(config.actions.dist)
})
})

an action with annotation `web-export: raw` should be considered a web action in getActionUrl

See:

const webArg = action['web-export'] || action.web

Expected

If I set the annotation web-export for an action to raw, it is considered a web action url

Actual

If I set the annotation web-export for an action to raw, it is considered a non-web action url

Fix

  1. add a failing test
  2. Replace the quoted line above with const webArg = action?.annotations?.['web-export'] || action?.web

error message at the end of activation logs is shown

Description

aio app run, aio app logs --tail and aio runtime activation logs --tail all three use lib runtime to implement activation log tailing, and in each command, after each log is printed the following error message is also shown:

The log message can't be retrieved, key not found: log_message

Expected behavior

no error message should be shown

Reproduce

  • init firefly app with UI and action generic
  • Terminal 1: aio app run
  • Terminal 2: aio app logs --tail
  • Terminal 3: aio runtime activation logs --tail
  • Invoke action generic from the UI
  • Check logs in all three terminals

EDIT see update comment below, this affects all log commands including wsk, so the issue is on the backend

Log forwarding New Relic support

Expected Behaviour

Feature request.
Add New Relic support in log forwarding

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

imsOrgId for headless validator is not needed anymore

Now the headless validator is calling Ext Registry just like the SPA validator, meaning it doesn't need to store the imsOrgId for custom validation. Unless we plan to rollback the old headless validator, we should get rid of

  1. the logic adding the imsOrgId to state lib
  2. the error Error: imsOrgId must be defined when using the Adobe headless auth validator

Add tests for build outputs

Developers are using our build outputs:

  1. web-src/src/config.json
  2. dist/actions/{ACTIONNAME}.zip (one per action)

This has caused breakage when developers depended on the naming of these outputs (or how the contents are named), and we updated these outputs to support multiple packages: #15

Add tests that test the various build outputs so that they conform to the expected (backwards compatible) formats.

Support node engine 16

Is there a plan to support node 16? Or rather, any concerns in bumping the node engine clause to include v16?

Expected Behaviour

Can you the library with node 16.

Actual Behaviour

package.json requires node 10, 12 or 14.

"node": "^10 || ^12 || ^14"

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

e2e test logs have `undefined`

console.log
    Info: Deleting API route [undefined /base/path [undefined]] for API [api1]...

      at Object.undeployPackage (src/utils.js:1524:5)

  console.log
    Info: API route [undefined /base/path [undefined]] successfully deleted.

Custom Webpack config not supported with ES Modules

Expected Behaviour

  • Custom Webpack configuration can be provided for a project using ES Modules.

Actual Behaviour

➜  sequence_test git:(main) ✗ aio app run --local
ℹ checking if java is installed...
ℹ checking if docker is installed...
ℹ checking if docker is running...
ℹ starting local OpenWhisk stack...
ℹ writing credentials to tmp wskdebug config '/Users/mgoberling/repos/adobe/my-utils/utils/sequence_test/dist/application/.env.local'
ℹ building actions..
 ›   Error: require() of ES Module /Users/mgoberling/repos/adobe/my-utils/utils/sequence_test/actions/first/webpack-config.js from 
 ›   /usr/local/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-lib-runtime/src/build-actions.js not supported.
 ›   Instead change the require of webpack-config.js in /usr/local/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-lib-runtime/src/build-actions.js to a dynamic 
 ›   import() which is available in all CommonJS modules.

Steps to Reproduce

  • aio app init with action
  • Add webpack-configuration.js to your action folder
  • Add "type": "module" to project package.json
  • Run aio app run --local
  • See error above

Additional notes

Due to import when building actions here

custom webpack config doesn't work with arrays, config factory functions, or promises

Expected Behaviour

This library now supports Webpack config files that export plain config objects. But Webpack itself supports other configuration types, some of which are necessary for some basic functionality.

  1. To build config based on runtime conditions, the Webpack config file should be able to export a factory function which receives an env object and returns a plain config object.
  2. To build config that requires some data from an async operation, the Webpack config file should be able to export a Promise which resolves to a plain config object.
  3. It should also be possible to export an async factory function that receives an env object and returns a Promise for a plain config object.
  4. In order to compile multiple bundles in parallel, you should be able to export an array of any of the above types.

Actual Behaviour

Only the plain object type of config is supported in webpack-config.js.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. Put the following in webpack-config.js:
    module.exports = { mode: "development" };
  2. Run aio app:deploy -v.
  3. Observe that the app is built in dev mode.
  4. Change webpack-config.js to the following:
    module.exports = async () => ({ mode: "development" });
  5. Run aio app:deploy -v again.
  6. Observe that the app was not built in dev mode. This legal Webpack config type was not honored.

Platform and Version

{
  '@adobe/aio-cli': '5.0.1',
  npm: '7.5.2',
  node: '12.19.1',
  '@adobe/aio-lib-runtime': '1.1.0'
}

support for shared packages in manifest

shared: true option in manifest deployments would be nice.

The current way to set a package to shared is aio runtime package update <my-pkg> --shared true

Store true/false as boolean values as opposed to string

Expected Behaviour

When setting an action's annotation via aio rt:action:update <myaction> -a<mybool> true, the value for the resulting annotation should actually be a boolean value. E.g. required for the web-custom-options annotation.

Actual Behaviour

true/false boolean values are actually stored as strings which breaks the custom OPTIONS response that one of our action need to send for app-specific CORS behavior.

Using npm module (inline-css) in global packages.json leads to error in webpack

Expected Behaviour

Normal packaging and deployment

Actual Behaviour

Error when executing aio app run --local

Reproduce Scenario (including but not limited to)

  • add npm module inline-css to dependencies
  • add const inlineCss = require('inline-css'); to index.js
  • run aio app run --local

Steps to Reproduce

Platform and Version

mac osx 10.14.5
node v13.2.0
npm 6.13.1

Sample Code that illustrates the problem

Logs taken while reproducing problem

[13:47:48] sroesing:my-first-aio-app $ > Local Dev Server
ℹ checking if docker is installed...
ℹ checking if docker is running...
ℹ starting local OpenWhisk stack..
⠸ Local Dev Server
        ____      ___                   _    _ _     _     _
       /\   \    / _ \ _ __   ___ _ __ | |  | | |__ (_)___| | __
  /\  /__\   \  | | | | '_ \ / _ \ '_ \| |  | | '_ \| / __| |/ /
 /  \____ \  /  | |_| | |_) |  __/ | | | |/\| | | | | \__ \   <
 \   \  /  \/    \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\
  \___\/ tm           |_|
Git Commit: 6de96ed, Build Date: 2019-07-31T10:53:17+0530
================================================================================
Running pre flight checks ...
⠴ Local Dev Server[  OK   ] 'docker' cli found. (Docker version 19.03.2, build 6a30dfc)
[  OK   ] 'docker' version 19.3.2 is newer than minimum supported 18.3.0
⠧ Local Dev Server[  OK   ] 'docker' is running.
⠇ Local Dev Server[  OK   ] 'wsk' cli found.
⠙ Local Dev Server[ WARN  ] Configure wsk via below command to connect to this server as [guest]
wsk property set --apihost 'http://localhost:3233' --auth '23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP'
[  OK   ] Server port [3233] is free
================================================================================
⠼ Local Dev Server[2019-11-27T14:09:11.214Z] [INFO] Starting OpenWhisk standalone on port 3233
⠏ Local Dev Server[2019-11-27T14:09:11.649Z] [INFO] Slf4jLogger started
⠹ Local Dev Server[2019-11-27T14:09:11.917Z] [INFO] Using [/Users/sroesing/.openwhisk/standalone/server-3233] as data directory
⠧ Local Dev Server[2019-11-27T14:09:12.331Z] [INFO] [#tid_sid_unknown] [MemoryArtifactStore] Created MemoryStore for [subjects]
⠏ Local Dev Server[2019-11-27T14:09:12.434Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore] [GET] 'subjects' finding document: 'id: guest' [marker:database_getDocument_start:227]
[2019-11-27T14:09:12.439Z] [INFO] Starting the Kamon(SystemMetrics) module
⠙ Local Dev Server[2019-11-27T14:09:12.616Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore]  [marker:database_getDocument_finish:410:1]
⠹ Local Dev Server[2019-11-27T14:09:12.660Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore] [PUT] 'subjects' saving document: 'id: guest, rev: null' [marker:database_saveDocument_start:455]
[2019-11-27T14:09:12.665Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore]  [marker:database_saveDocument_finish:460:5]
[2019-11-27T14:09:12.666Z] [INFO] [#tid_sid_userBootstrap] [StandaloneOpenWhisk] Created user [guest]
[2019-11-27T14:09:12.718Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore] [GET] 'subjects' finding document: 'id: whisk.system' [marker:database_getDocument_start:34]
[2019-11-27T14:09:12.718Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore]  [marker:database_getDocument_finish:34:0]
[2019-11-27T14:09:12.721Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore] [PUT] 'subjects' saving document: 'id: whisk.system, rev: null' [marker:database_saveDocument_start:37]
[2019-11-27T14:09:12.721Z] [INFO] [#tid_sid_cli] [MemoryArtifactStore]  [marker:database_saveDocument_finish:37:0]
[2019-11-27T14:09:12.722Z] [INFO] [#tid_sid_userBootstrap] [StandaloneOpenWhisk] Created user [whisk.system]
⠸ Local Dev Server[2019-11-27T14:09:12.798Z] [INFO] The kamon.reporters setting is empty, no reporters have been started.
⠴ Local Dev Server[2019-11-27T14:09:12.984Z] [INFO] [#tid_sid_unknown] [Config] system set value for limits.triggers.fires.perMinute
[2019-11-27T14:09:12.984Z] [INFO] [#tid_sid_unknown] [Config] system set value for limits.actions.sequence.maxLength
[2019-11-27T14:09:12.984Z] [INFO] [#tid_sid_unknown] [Config] system set value for limits.actions.invokes.concurrent
[2019-11-27T14:09:12.985Z] [INFO] [#tid_sid_unknown] [Config] system set value for whisk.api.host.name
[2019-11-27T14:09:12.985Z] [INFO] [#tid_sid_unknown] [Config] system set value for limits.actions.invokes.perMinute
[2019-11-27T14:09:12.985Z] [INFO] [#tid_sid_unknown] [Config] system set value for whisk.api.host.proto
[2019-11-27T14:09:12.985Z] [INFO] [#tid_sid_unknown] [Config] system set value for whisk.api.host.port
[2019-11-27T14:09:12.985Z] [INFO] [#tid_sid_unknown] [Config] system set value for runtimes.manifest
[2019-11-27T14:09:12.986Z] [INFO] [#tid_sid_unknown] [Config] system set value for port
⠧ Local Dev Server[2019-11-27T14:09:13.139Z] [INFO] [#tid_sid_unknown] [LeanMessagingProvider] topic completedstandalone created
[2019-11-27T14:09:13.140Z] [INFO] [#tid_sid_unknown] [LeanMessagingProvider] topic health created
[2019-11-27T14:09:13.140Z] [INFO] [#tid_sid_unknown] [LeanMessagingProvider] topic cacheInvalidation created
[2019-11-27T14:09:13.140Z] [INFO] [#tid_sid_unknown] [LeanMessagingProvider] topic events created
⠋ Local Dev Server[2019-11-27T14:09:13.372Z] [INFO] [#tid_sid_controller] [Controller] starting controller instance standalone [marker:controller_startup_counter:1299]
⠙ Local Dev Server[2019-11-27T14:09:13.442Z] [INFO] [#tid_sid_unknown] [MemoryArtifactStore] Created MemoryStore for [whisks]
[2019-11-27T14:09:13.466Z] [INFO] [#tid_sid_dispatcher] [MessageFeed] handler capacity = 128, pipeline fill at = 128, pipeline depth = 256
⠹ Local Dev Server[2019-11-27T14:09:13.488Z] [INFO] [#tid_sid_dispatcher] [MessageFeed] handler capacity = 128, pipeline fill at = 128, pipeline depth = 256
⠼ Local Dev Server[2019-11-27T14:09:13.704Z] [INFO] [#tid_sid_unknown] [ExtendedDockerClient] Detected docker client version 19.03.2
[2019-11-27T14:09:13.705Z] [INFO] [#tid_sid_unknown] [InvokerReactive] LogStoreProvider: class org.apache.openwhisk.core.containerpool.docker.DockerCliLogStore
⠦ Local Dev Server[2019-11-27T14:09:13.818Z] [INFO] [#tid_sid_unknown] [DockerForMacClient] Detected docker client version 19.03.2
⠧ Local Dev Server[2019-11-27T14:09:13.957Z] [INFO] [#tid_sid_unknown] [StandaloneDockerContainerFactory] Standalone docker container factory config pullStandardImages: true
[2019-11-27T14:09:13.959Z] [INFO] [#tid_sid_invoker] [DockerForMacClient] running /usr/local/bin/docker ps --quiet --no-trunc --all --filter name=wsk0_ (timeout: 1 minute) [marker:invoker_docker.ps_start:1885]
⠇ Local Dev Server[2019-11-27T14:09:14.038Z] [INFO] [#tid_sid_invoker] [DockerForMacClient]  [marker:invoker_docker.ps_finish:1964:79]
⠏ Local Dev Server[2019-11-27T14:09:14.056Z] [INFO] [#tid_sid_invoker] [StandaloneDockerContainerFactory] removing 0 action containers.
⠙ Local Dev Server[2019-11-27T14:09:14.256Z] [INFO] [#tid_sid_unknown] [MemoryArtifactStore] Created MemoryStore for [activations]
⠹ Local Dev Server[2019-11-27T14:09:14.345Z] [INFO] [#tid_sid_invoker] [MemoryArtifactStore] [QUERY] 'subjects' searching 'namespaceThrottlings/blockedNamespaces [marker:database_queryView_start:2271]
[2019-11-27T14:09:14.354Z] [INFO] [#tid_sid_invoker] [MemoryArtifactStore]  [marker:database_queryView_finish:2281:9]
[2019-11-27T14:09:14.357Z] [INFO] [#tid_sid_unknown] [InvokerReactive] updated blacklist to 0 entries
⠸ Local Dev Server[2019-11-27T14:09:14.424Z] [INFO] [#tid_sid_dispatcher] [MessageFeed] handler capacity = 40, pipeline fill at = 40, pipeline depth = 80
⠴ Local Dev Server[2019-11-27T14:09:14.544Z] [INFO] [#tid_sid_controller] [Controller] loadbalancer initialized: LeanBalancer
[2019-11-27T14:09:14.544Z] [INFO] [#tid_sid_invokerWarmup] [ContainerPool] pre-warming 2 nodejs:10 256 MB
⠦ Local Dev Server[2019-11-27T14:09:14.629Z] [INFO] [#tid_sid_controller] [KindRestrictor] all kinds are allowed, the white-list is not specified
[2019-11-27T14:09:14.643Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient] running /usr/local/bin/docker pull openwhisk/action-nodejs-v10:nightly (timeout: 10 minutes) [marker:invoker_docker.pull_start:2569]
[2019-11-27T14:09:14.645Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient] running /usr/local/bin/docker pull openwhisk/action-nodejs-v10:nightly (timeout: 10 minutes) [marker:invoker_docker.pull_start:2569]
⠇ Local Dev Server[2019-11-27T14:09:14.837Z] [INFO] [#tid_sid_unknown] [ExtendedDockerClient] Detected docker client version 19.03.2
⠸ Local Dev Server[2019-11-27T14:09:15.260Z] [INFO] [#tid_sid_controller] [ActionsApi] actionSequenceLimit '50'
⠹ Local Dev ServerWaiting for OpenWhisk server at http://localhost:3233 to start since 1.109 ms
⠧ Local Dev Server[2019-11-27T14:09:16.406Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient]  [marker:invoker_docker.pull_finish:4333:1763]
[2019-11-27T14:09:16.407Z] [INFO] [#tid_sid_unknown] [StandaloneDockerContainerFactory] Pulled OpenWhisk provided image openwhisk/action-nodejs-v10:nightly
[2019-11-27T14:09:16.407Z] [INFO] [#tid_sid_unknown] [StandaloneDockerContainerFactory] Pulled OpenWhisk provided image openwhisk/action-nodejs-v10:nightly
⠇ Local Dev Server[2019-11-27T14:09:16.449Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient] running /usr/local/bin/docker run -d -p 0:8080 --cpu-shares 256 --memory 256m --memory-swap 256m --network bridge -e __OW_API_HOST=http://host.docker.internal:3233 --name wsk0_1_prewarm_nodejs10 --cap-drop NET_RAW --cap-drop NET_ADMIN --ulimit nofile=1024:1024 --pids-limit 1024 --log-driver json-file openwhisk/action-nodejs-v10:nightly (timeout: 1 minute) [marker:invoker_docker.run_start:4376]
[2019-11-27T14:09:16.450Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient] running /usr/local/bin/docker run -d -p 0:8080 --cpu-shares 256 --memory 256m --memory-swap 256m --network bridge -e __OW_API_HOST=http://host.docker.internal:3233 --name wsk0_2_prewarm_nodejs10 --cap-drop NET_RAW --cap-drop NET_ADMIN --ulimit nofile=1024:1024 --pids-limit 1024 --log-driver json-file openwhisk/action-nodejs-v10:nightly (timeout: 1 minute) [marker:invoker_docker.run_start:4376]
[2019-11-27T14:09:16.453Z] [INFO] [#tid_klmHdHGDE1UcUjVSzv7nspOblTilP5jW] GET /api/v1
⠏ Local Dev Server[2019-11-27T14:09:16.533Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient]  [marker:invoker_docker.pull_finish:4459:1889]
[2019-11-27T14:09:16.560Z] [INFO] [#tid_klmHdHGDE1UcUjVSzv7nspOblTilP5jW] [BasicHttpService] [marker:http_get.200_counter:115:115]
ℹ saving .env to .env.app.save and writing new .env with local OpenWhisk guest credentials..
ℹ redeploying actions..
⠙ Local Dev Serverresetting .env file...
killing local OpenWhisk process...
✖ Local Dev Server
[2019-11-27T14:09:16.834Z] [INFO] [#tid_sid_invoker] [DockerForMacClient] running /usr/local/bin/docker ps --quiet --no-trunc --all --filter name=wsk0_ (timeout: 1 minute) [marker:invoker_docker.ps_start:4761]
Error: action build failed, webpack compilation errors:
./actions/hello/index.js
Module not found: Error: Can't resolve 'inline-css' in '/Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/actions/hello'
resolve 'inline-css' in '/Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/actions/hello'
  Parsed request is a module
  using description file: /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/package.json (relative path: ./actions/hello)
    resolve as module
      /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/actions/hello/node_modules doesn't exist or is not a directory
      /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/actions/node_modules doesn't exist or is not a directory
      /Users/sroesing/Development/aio/my-first-aio-app/node_modules doesn't exist or is not a directory
      /Users/sroesing/Development/aio/node_modules doesn't exist or is not a directory
      /Users/sroesing/Development/node_modules doesn't exist or is not a directory
      /Users/sroesing/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/node_modules
        using description file: /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/package.json (relative path: ./node_modules)
          using description file: /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/package.json (relative path: ./node_modules/inline-css)
            no extension
              /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/node_modules/inline-css doesn't exist
            .js
              /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/node_modules/inline-css.js doesn't exist
            as directory
              /Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/node_modules/inline-css doesn't exist
[/Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/actions/hello/node_modules]
[/Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/actions/node_modules]
[/Users/sroesing/Development/aio/my-first-aio-app/node_modules]
[/Users/sroesing/Development/aio/node_modules]
[/Users/sroesing/Development/node_modules]
[/Users/sroesing/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/node_modules/inline-css]
[/Users/sroesing/Development/aio/my-first-aio-app/my-first-aio-app/node_modules/inline-css.js]
 @ ./actions/hello/index.js 9:18-39
 @ multi ./actions/hello/index.js
    at /usr/local/lib/node_modules/@adobe/aio-cli/node_modules/@adobe/aio-app-scripts/scripts/build.actions.js:84:46
    at finalCallback (/usr/local/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:257:39)
    at /usr/local/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:273:13
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (/usr/local/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/Hook.js:154:20)
    at onCompiled (/usr/local/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:271:21)
    at /usr/local/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:681:15
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/usr/local/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at AsyncSeriesHook.lazyCompileHook (/usr/local/lib/node_modules/@adobe/aio-cli/node_modules/tapable/lib/Hook.js:154:20)
    at /usr/local/lib/node_modules/@adobe/aio-cli/node_modules/webpack/lib/Compiler.js:678:31
[2019-11-27T14:09:16.913Z] [INFO] [#tid_sid_invoker] [DockerForMacClient]  [marker:invoker_docker.ps_finish:4840:79]
[2019-11-27T14:09:16.914Z] [INFO] [#tid_sid_invoker] [StandaloneDockerContainerFactory] removing 2 action containers.
[2019-11-27T14:09:16.916Z] [INFO] [#tid_sid_invoker] [DockerForMacClient] running /usr/local/bin/docker rm -f 1b92666678596a34b2488dacbc3fdddecb80719ae78fdf448aa674c709e3a38a (timeout: 1 minute) [marker:invoker_docker.rm_start:4843]
[2019-11-27T14:09:16.917Z] [INFO] [#tid_sid_invoker] [DockerForMacClient] running /usr/local/bin/docker rm -f 7aea8f64ea942db221292150b6e0a78856caefdd9c408a7ce9af64f4cd3e8e4a (timeout: 1 minute) [marker:invoker_docker.rm_start:4844]
[14:09:16] sroesing:my-first-aio-app $ Waiting for OpenWhisk server at http://localhost:3233 to start since 1.009 s
[2019-11-27T14:09:17.162Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient]  [marker:invoker_docker.run_finish:5089:713]
[2019-11-27T14:09:17.163Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient] running /usr/local/bin/docker inspect --format {{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}} 7aea8f64ea942db221292150b6e0a78856caefdd9c408a7ce9af64f4cd3e8e4a (timeout: 10 seconds) [marker:invoker_docker.inspect_start:5089]
[2019-11-27T14:09:17.243Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient]  [marker:invoker_docker.inspect_finish:5170:81]
[2019-11-27T14:09:17.291Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient]  [marker:invoker_docker.run_finish:5217:841]
[2019-11-27T14:09:17.291Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient] running /usr/local/bin/docker inspect --format {{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}} 1b92666678596a34b2488dacbc3fdddecb80719ae78fdf448aa674c709e3a38a (timeout: 10 seconds) [marker:invoker_docker.inspect_start:5218]
[2019-11-27T14:09:17.358Z] [INFO] [#tid_sid_invokerWarmup] [DockerForMacClient]  [marker:invoker_docker.inspect_finish:5285:67]
[2019-11-27T14:09:17.916Z] [INFO] [#tid_sid_invoker] [DockerForMacClient]  [marker:invoker_docker.rm_finish:5843:999]
Waiting for OpenWhisk server at http://localhost:3233 to start since 2.013 s
[2019-11-27T14:09:18.030Z] [INFO] [#tid_sid_invoker] [DockerForMacClient]  [marker:invoker_docker.rm_finish:5957:1114]
[2019-11-27T14:09:18.038Z] [INFO] [#tid_sid_unknown] [Controller] Shutting down Kamon with coordinated shutdown

Sequence logs are not returned

Expected Behaviour

Logs from individual actions in the sequence should be returned

Actual Behaviour

No logs

Reproduce Scenario (including but not limited to)

Have a sequence in the manifest and use aio app logs

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Bug: imsOrgId must be defined when using the Adobe headless auth validator

Expected Behaviour

The headless auth validator is a thing of the past. Adobe auth checks, when require-adobe-auth is enabled, are now only made through the app-registry validator.

We need to clean up all the code that sets the org in state lib.

throw new Error('imsOrgId must be defined when using the Adobe headless auth validator')

Workaround

A workaround is to set the AIO_PROJECT_ORG_IMS__ORG__ID environment variable.

Fix

Remove the setupAdobeAuth function and all references:

async function setupAdobeAuth (actions, owOptions, imsOrgId) {

Getting error while trying to set splunk logging

Getting following error while running the splunk set up command

_*Error: failed to update log forwarding configuration: Could not update log forwarding settings for namespace 'undefined': Only absolute URLs are supported
› specify --verbose flag for more information*_

Command:
_* aio runtime namespace log-forwarding set ? select log forwarding destination Splunk HEC
? host <host>
? port 443
? index <index>
? hec_token [hidden]*_

Wsk Configuration
_*
whisk API host adobeioruntime.net
whisk auth <auth>
whisk namespace <namespace>
client cert
Client key
whisk API version v1
whisk CLI version 2021-04-01T23:49:54.523+0000
whisk API build 2019-04-05-18:03:02Z
whisk API build number 20190405a*_

command - aio rt ns list
output - Namespaces
─────────────────────
<namespace>

command aio info
output
System:
OS: macOS 12.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 191.90 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.16.1 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.12 - /usr/local/bin/npm
Virtualization:
Docker: 20.10.6 - /usr/local/bin/docker
npmGlobalPackages:
@adobe/aio-cli: 8.2.0

Proxies:
http: (not set)
https: (not set)
CLI plugins:
core:
@adobe/aio-cli 8.2.0
@adobe/aio-cli-plugin-app 8.4.0
@adobe/aio-cli-plugin-auth 2.5.0
@adobe/aio-cli-plugin-certificate 0.3.0
@adobe/aio-cli-plugin-config 2.3.0
@adobe/aio-cli-plugin-console 3.4.2
@adobe/aio-cli-plugin-events 1.1.5
@adobe/aio-cli-plugin-info 2.1.0
@adobe/aio-cli-plugin-runtime 5.1.0
@oclif/plugin-autocomplete 0.3.0
@oclif/plugin-help 2.2.3
@oclif/plugin-not-found 2.2.0
@oclif/plugin-plugins 1.10.2
@oclif/plugin-warn-if-update-available 1.7.0
user:
link:

command - aio rt ns lf get
output -
› Error: failed to get log forwarding configuration: Could not get log forwarding settings for namespace 'undefined': Only absolute URLs are supported
› specify --verbose flag for more information

Cannot release on windows

Expected Behaviour

np --no-publish should work
npm run typings should work

Actual Behaviour

npm run typings fails which blocks np from releasing

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

windows

Sample Code that illustrates the problem

Logs taken while reproducing problem

ERROR: Unable to find the source file or directory C:\repos\adobe\aio-lib-runtime\'src\*.js'

utils.getActionUrls returns different action name format if action is in the first package

packages:
  pkg1:
     actions:
       my-action:
         web: true
  pkg2:
     actions:
       my-action2:
         web: true

would return url object like:

{
  'myaction': <url>,
  'pkg2/my-action2': <url>
}

the expected should be like:

{
  'pkg1/myaction': <url>,
  'pkg2/my-action2': <url>
}

Why does this matter ?
Commands calling this method shouldn't need to treat action names differently depending on the package position in the manifest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.