adobe / adobeio-cna-starter-project Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED - Please use https://github.com/adobe/aio-cli to manage your future apps!
Home Page: https://adobe.io
License: Apache License 2.0
DEPRECATED - Please use https://github.com/adobe/aio-cli to manage your future apps!
Home Page: https://adobe.io
License: Apache License 2.0
2 action build modes are supported for now:
a. in manifest.yml point to action file: Minifies action and action's dependencies using parcel
b. in manifest.yml point to the action's directory + package.json file in action's folder: Installs dependencies and zips the action
But if we point to an action file + have a package.json file in the folder, parcel installs unnecessary dev dependencies such as @babel/core
which pollutes the action folder with a package-lock.json
and node_modules/
and modifies the package.json
file.
Best: bundle action with parcel without polluting folder
Middle: don't bundle with parcel, create a zip action instead if there is a package.json file
at least: show an error
Unnecessary installed dependencies in developer's action folder
cd actions/hello
npm init
cd ../../
npm run build:actions
Deploy works
Deploy fails
Create an action with a dependency on bwip-js
, in scripts/build.actions.js
verify that minify
is set to true
.
See https://github.com/icaraps/cna-barcode-generator/blob/master/actions/barcode/index.js
Returned HTTP 400 (Bad Request) -->
› "The request content was malformed:
› Unexpected end-of-input at input index 1623 (line 1, position 1624),
› expected '"':
Currently we are just doing e2e testing in travis on local builds
Testing of deployment is missing, add a remote deployment command to travis and run an e2e test on it.
To solve this we probably need:
Write an action with a dependency on node-canvas to render a canvas.
See the example at https://github.com/Automattic/node-canvas
TypeError: bindings.CanvasRenderingContext2dInit is not a function
Deploy UI URL should point to the UI I am working on
https://<namespace>.dev.adobe-runtime.com/adobeio-cna-starter-project-0.1.0/index.html
seems to be always pointing to deployment of cna-demo
instead of owner's namespace s3 folder
This is misleading at first and creates CORS issues to access the backend
After making changes to the UI it is clear that the deployment URL is not pointing to the desired deployment
Use a different namespace than cna-demo
The config file that is generated by the build should include text to make sure that users don't think they should modify it.
Relates to parcel-bundler/parcel#2581
npm install node-fetch
actions/hello/index.js
withconst fetch = require('node-fetch')
async function main (args) {
try {
const content = await fetch('https://jsonplaceholder.typicode.com/todos/1')
return {
body: await content.json()
}
} catch (e) {
console.error(e)
return {
body: e.message
}
}
}
exports.main = main
scripts/build.actions.js
replace minify: true,
with minify:false,
npm run build:actions && npm run deploy:actions
fetch is not a function
Note 1: node-fetch
is exported as an es6 module
Note 2: The same action works fine if deployed as a zip action
In the action replace const fetch = require('node-fetch')
with const fetch = require('node-fetch').default
When running npm run dev and do some code changes for example in an action an additional chrome tab will be automatically opened pointing to http://localhost:9800.
This can be very annoying when multiple changes are done and saved.
Way better would be, do nothing and let the developer refresh the page.
When running the command
'npm run dev' I get the following error
'NODE_ENV' is not recognized as an internal or external command
Start the local development server
get the following error
'NODE_ENV' is not recognized as an internal or external command
Running 'npm run dev' on Windows command line
packages:
__CNA_PACKAGE__:
license: Apache-2.0
actions:
hello:
function: actions/hello
web: yes
runtime: 'nodejs:10'
A ZIP is build, but the JavaScript is never compiled with npm.
Currently the starter project is using Mocha + Chai for unit tests.
Move the unit test setup to Jest, so that all CNA apps use the same testing tools
Server side static files required by dependencies are uploaded
Server side static files are not uploaded
See https://github.com/icaraps/cna-barcode-generator/blob/master/actions/barcode/index.js.
Set includetext
to true
.
Since the fonts are not uploaded, the includetext
option won't work.
Same issue as described here metafloor/bwip-js#118
Documentation:
New comers miss the information on how to acquire the I/O Runtime / OpenWhisk credentials which are needed to use the starter.
We should add this to the README
Currently every commit/pr triggers an end to end build, which includes installing google chrome. It's 54MB and our tests on windows are taking 8-10 minutes.
It seems that aio runtime
truncates the code and this results in a malformed request error
✖ Deploy actions
› Error: Command failed: aio runtime deploy -m /Users/mraho/work/adobeio-cna-starter-project/.manifest-dist.yml
› › Error: Failed to deploy: the request content was malformed:
› › unexpected end-of-input at input index 74845 (line 1, position 74846),
› › expected '"':
This also doesn't work with wskdeploy -m .manifest-dist.yml
and wsk action create myaction dist/actions/hello.js
$ npm install @adobe/aio-cli-config
const config = require('@adobe/aio-cli-config')
to the top of actions/hello/index.js
npm run build:actions && npm run deploy:actions
or aio cna deploy -av
Action sequence should be covered by the UI build script so that it can be called from the UI.
Sequences can not be called from the UI.
Applications that need to invoke a sequence of actions instead of single actions.
In manifest.yml, add sequences
section:
packages:
__CNA_PACKAGE__:
license: Apache-2.0
actions:
hello:
function: actions/hello/index.js
web: yes
runtime: 'nodejs:10'
hello2:
function: actions/hello/index.js
web: yes
runtime: 'nodejs:10'
sequences:
hello-sequence:
actions: hello, hello2
Please see Steps to reproduce
.
Action deployment hangs forever when having a dependency to openwhisk
module + parcel minification on build
npm install openwhisk
const openwhisk = require('openwhisk')
on top of actions/hello/index.js
npm run deploy:actions
aio cna deploy -av
aio runtime create hello dist/actions/hello.js
wsk action create hello dist/actions/hello.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.