nimbella / netlify-plugin-nimbella Goto Github PK
View Code? Open in Web Editor NEWA Nimbella plugin to extend Netlify Sites with support for portable and stateful serverless APIs.
Home Page: https://nimbella.com
License: Apache License 2.0
A Nimbella plugin to extend Netlify Sites with support for portable and stateful serverless APIs.
Home Page: https://nimbella.com
License: Apache License 2.0
Hello, I'm getting an error while trying to install the plugin's dependencies:
12:20:37 PM: ────────────────────────────────────────────────────────────────
12:20:37 PM: Dependencies installation error
12:20:37 PM: ────────────────────────────────────────────────────────────────
12:20:37 PM:
12:20:37 PM: Error message
12:20:37 PM: Error while installing dependencies in /opt/build/repo/.netlify/plugins/
12:20:37 PM: npm ERR! code E404
12:20:37 PM: npm ERR! 404 Not Found - GET https://apigcp.nimbella.io/downloads/nim/nim-v1.8.0/nim-v1.8.0.tar.gz
12:20:37 PM: npm ERR! 404
12:20:37 PM: npm ERR! 404 'nimbella-cli@https://apigcp.nimbella.io/downloads/nim/nim-v1.8.0/nim-v1.8.0.tar.gz' is not in the npm registry.
12:20:37 PM: npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
12:20:37 PM: npm ERR! 404 It was specified as a dependency of 'netlify-plugin-nimbella'
12:20:37 PM: npm ERR! 404
12:20:37 PM: npm ERR! 404 Note that you can also install from a
12:20:37 PM: npm ERR! 404 tarball, folder, http url, or git url.
https://app.netlify.com/sites/gatsby-starter-netlify-cms-erez/deploys/5fd0b29985acf600079497f8
It seems the following URL
netlify-plugin-nimbella/package.json
Line 34 in a337de6
Could this loop be done in parallel?
netlify-plugin-nimbella/index.js
Line 31 in beca8fd
Considering this uploads files it could improve performance.
According to https://nimbella.io/downloads/nim/nim.html nim
CLI requires minimum version of node 10.
This should be reflected in the package.json
engines
property so users get a relevant error message if they don't have the required version.
To reproduce:
Use https://github.com/nimbella/netlify-plugin-nimbella#minimal-netlify-toml-configuration, e.g. a netlify.toml
as such:
[[plugins]]
package = "netlify-plugin-nimbella"
See https://app.netlify.com/sites/determined-johnson-c85a62/deploys/5f79bdc630173a00089717dc
Error message:
Error: Cannot read property 'functions' of undefined
I believe this error is coming from:
netlify-plugin-nimbella/index.js
Line 96 in 108706a
I would also recommend checking if netlify.toml
exists as some sites don't have it (e.g. you install the plugin using the UI)
hello, i've been trying to build my site on netlify but the deploys are constantly failing and this seems to be the reason.
6:05:11 PM: ❯ Installing plugins
6:05:11 PM: - [email protected]
6:13:00 PM:
6:13:00 PM: Dependencies installation error
6:13:00 PM: ────────────────────────────────────────────────────────────────
6:13:00 PM:
6:13:00 PM: Error message
6:13:00 PM: Error while installing dependencies in /opt/build/repo/.netlify/plugins/
6:13:00 PM: npm ERR! code ETIMEDOUT
6:13:00 PM: npm ERR! syscall connect
6:13:00 PM: npm ERR! errno ETIMEDOUT
6:13:00 PM: npm ERR! network request to https://apigcp.nimbella.io/downloads/nim/nimbella-cli.tgz failed, reason: connect ETIMEDOUT 35.199.52.22:443
6:13:00 PM: npm ERR! network This is a problem related to network connectivity.
6:13:00 PM: npm ERR! network In most cases you are behind a proxy or have bad network settings.
6:13:00 PM: npm ERR! network
6:13:00 PM: npm ERR! network If you are behind a proxy, please make sure that the
6:13:00 PM: npm ERR! network 'proxy' config is set properly. See: 'npm help config'
6:13:00 PM:
6:13:01 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
If nimbella wont work is there any other way to work with python api in netlify?
Automate tests for PRs and configure checks.
The project deployment currently ignores the web folder explicitly. Amend the build configuration to allow the inclusion of the web folder.
netlify-plugin-nimbella/src/index.js
Line 24 in 8c29a9a
This feature could be togged with a netlify env var NIMBELLA_DEPLOY_WEB
set to true
.
The plugin sets all of process.env
variables as secrets:
netlify-plugin-nimbella/index.js
Line 119 in 108706a
This can leak unwanted variables, especially when run locally.
To reproduce run netlify build
locally with the plugin configured and see the generated env.json
file
You can also run
nim action get <action>
to see all the env vars added during build time
Related to #12
I might be wrong but
netlify-plugin-nimbella/index.js
Line 70 in 2969462
NIMBELLA_LOGIN_TOKEN
as an env variable.functions
input value is not empty).Instead of parsing netlify.toml
as a toml
file you could use require('netlify-redirect-parser').parseNetlifyConfig
constants.PUBLISH_DIR
is always defined, but might point to a directory which does not exist.
When this happens, this plugin crashes at the following line:
netlify-plugin-nimbella/src/index.js
Line 225 in 0b38edd
ENOTDIR: not a directory, open 'index.html/_redirects'
/opt/build/repo/.netlify/plugins/node_modules/netlify-plugin-nimbella/index.js:189:19 onPostBuild
This can be fixed by creating constants.PUBLISH_DIR
directory if it does not exist (e.g. using a library like make-dir
).
The plugin uses process.env.HOME
which is not available on Windows.
netlify-plugin-nimbella/index.js
Line 77 in 2969462
netlify build
will fail on Windows.
A possible fix can be to use require('os').homedir()
Netlify build wraps plugins event handlers with a try/catch
and report those as bugs.
Using catch-all
will result in reporting all errors as user errors (including bugs).
For example we might want to report a relevant error here:
netlify-plugin-nimbella/index.js
Line 84 in 2969462
Not sure if this is a feature. bug or a discussion.
Should the plugin remove old functions on each deploy? I noticed that if I delete a function locally and push the changes the endpoint is still available.
That might be confusing to some users.
The plugin assumes an API host. Add an environment variable to permit other API hosts.
netlify-plugin-nimbella/src/index.js
Lines 83 to 87 in 8c29a9a
This can be set using a netlify env var NIMBELLA_API_HOST
set to the desired api host, defaulting to a standard host if not specified.
I tried following the README by running netlify addons:create nimbella
and netlify addons:auth nimbell
.
netlify addons:create nimbella
creates the addon, netlify addons:auth nimbella
creates the auth link and opens the browser, but redirects to https://nimbella.com/.
I was able to use an existing account with nim auth export --non-expiring
.
Feel free to close this if this flow is not intended to work yet.
I'm not completely sure how this work on Nimbella's end, but is a separate endpoint created per deploy context?
e.g. if I run the plugin from a production context, then from a branch/Deploy Preview context would those endpoints co-exist on Nimbella's end?
As a part of reviewing netlify/plugins#155 I noticed the link to learn more about the integration is broken.
The standard way to add plugin configuration is via inputs
:
https://docs.netlify.com/configure-builds/build-plugins/create-plugins/#inputs
Those are parsed and passed to plugins as an argument.
In the future inputs might be available to users via UI configuration, using netlify.toml
will prevent that.
Also, top level configurations should be reserved for Netlify properties.
In some cases a process can fail and still have an exitCode
of 0
https://github.com/sindresorhus/execa#childprocessresult
You can use https://github.com/sindresorhus/execa#failed instead of exitCode
to handle those cases here:
netlify-plugin-nimbella/index.js
Line 45 in beca8fd
I'm trying to follow https://github.com/nimbella/netlify-plugin-nimbella#deploy-netlify-functions-on-nimbella-cloud
and getting this error:
https://app.netlify.com/sites/erez-build-reproductions/deploys/5f7c3a3e676f5553e5d3bb04
I believe it's coming from https://github.com/satyarohith/netlify-lambda/blob/0096a57fa11601b87eb20dbffe29166ed8f5df8e/lib/build.js#L34 expecting to find the removed nimbella
configuration. Looks like it should get that information from the plugin inputs
The following error is thrown.
10:01:01 PM: npx: installed 9 in 1.623s
10:01:01 PM: Cannot find module 'auth'
10:01:01 PM: Require stack:
10:01:01 PM: - /opt/buildhome/.npm/_npx/1344/lib/node_modules/nim/index.js
10:01:01 PM: - /opt/buildhome/.npm/_npx/1344/lib/node_modules/nim/bin/nim.js
10:01:02 PM: Error: Command failed with exit code 1: npx nim auth login ****
10:01:02 PM: at makeError (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/execa/lib/error.js:56:11)
10:01:02 PM: at handlePromise (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/execa/index.js:114:26)
10:01:02 PM: at processTicksAndRejections (internal/process/task_queues.js:97:5)
10:01:02 PM: at async onPreBuild (/opt/build/repo/netlify-plugin-nimbella/index.js:76:9)
10:01:02 PM: at async Object.run (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/run.js:17:3)
10:01:02 PM: at async handleEvent (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js:34:38)
10:01:02 PM: at async process.<anonymous> (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/ipc.js:102:9) {
10:01:02 PM: command: 'npx nim auth login ****',
10:01:02 PM: exitCode: 1,
10:01:02 PM: signal: undefined,
10:01:02 PM: signalDescription: undefined,
10:01:02 PM: stdout: '',
10:01:02 PM: stderr: 'npx: installed 9 in 1.623s\n' +
10:01:02 PM: "Cannot find module 'auth'\n" +
10:01:02 PM: 'Require stack:\n' +
10:01:02 PM: '- /opt/buildhome/.npm/_npx/1344/lib/node_modules/nim/index.js\n' +
10:01:02 PM: '- /opt/buildhome/.npm/_npx/1344/lib/node_modules/nim/bin/nim.js',
10:01:02 PM: failed: true,
10:01:02 PM: timedOut: false,
10:01:02 PM: isCanceled: false,
10:01:02 PM: killed: false
10:01:02 PM: }
I'm having a hard time accessing my functions after a successful deploy:
https://app.netlify.com/sites/determined-johnson-c85a62/deploys/5f79cbb4b714649255cbc826
https://github.com/erezrokah/netlify-build-reproductions/blob/plugin/nimbella/netlify.toml
My project structure is:
├── functions
│ └── hello.js
├── netlify.toml
├── packages
│ └── auth
│ └── login.js
├── public
│ └── index.html
I tried:
curl -i -L https://5f79cbb4b714649255cbc826--determined-johnson-c85a62.netlify.app/.netlify/functions/default/hello
curl -i -L https://5f79cbb4b714649255cbc826--determined-johnson-c85a62.netlify.app/.netlify/functions/hello
curl -i -L https://5f79cbb4b714649255cbc826--determined-johnson-c85a62.netlify.app/.netlify/functions/auth/login
All resulting in failures.
Also:
$ nim action get auth/login --url
$ https://apigcp.nimbella.io/api/v1/web/erezroka-0sjnfe3jhr5/auth/login
$ nim action get hello --url
$ https://apigcp.nimbella.io/api/v1/web/erezroka-0sjnfe3jhr5/default/hello
Trying to curl
the above URLs also fails.
What am I doing wrong?
It might be useful to print the excepted endpoint so users can easily verify them.
Currently the plugin installs the CLI on each build, which can be quite slow.
Netlify build installs all plugins dependencies before the build starts and we even pre-install dependencies in our build image for official plugins in https://github.com/netlify/plugins to make that process faster.
Also, the plugin uses npm
which might conflict with users using another package manager (e.g. yarn
).
See here an example of a plugin using a CLI as a local dependency.
Specifying dependencies versions is also important for creating consistent and reproducible builds
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.