Coder Social home page Coder Social logo

nimbella / netlify-plugin-nimbella Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 4.0 391 KB

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

JavaScript 100.00%
faas netlify netlify-plugin nimbella serverless

netlify-plugin-nimbella's People

Contributors

dependabot[bot] avatar erezrokah avatar rabbah avatar satyarohith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

netlify-plugin-nimbella's Issues

Failure to install plugin dependencies

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

"nimbella-cli": "https://apigcp.nimbella.io/downloads/nim/nim-v1.8.0/nim-v1.8.0.tar.gz"
returns 404

Bug: plugin fails with an error when there is no [nimbella] setting in netlify.toml

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:

isActions = existsSync(config.nimbella.functions);

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)

dependecies installation error

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?

This crashes when the publish directory does not exist

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:

await appendFile(redirectsFile, redirectRules.join('\n'));

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).

Feature: cleanup old functions

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.

Feature: allow login to different Nimbella API hosts

The plugin assumes an API host. Add an environment variable to permit other API hosts.

const {stdout} = await utils.run.command('nim auth current', {
stdout: 'pipe'
});
console.log(`Using the following namespace: ${stdout}`);
} catch (error) {

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.

Bug: netlify addons:auth nimbella redirects to https://nimbella.com/

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.

Question: is a different endpoint generated per deploy context?

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?

Bug: TypeError: Cannot read property 'functions' of undefined when trying to build Netlify functions

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

Login isn't working anymore after using `npx nim auth`

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: }

Feature: print functions endpoints to logs after deploy

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.

Chore: add nim CLI as a dependency instead of globally installing on each build

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

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.