Feature: print functions endpoints to logs after deploy
Closed this issue · 2 comments
erezrokah commented
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.
rabbah commented
I looked at the repo and successfully deployed it but had to make a couple of corrections to the functions. Here is the diff.
- the function entry point for nimbella is called
main
by default (so eitherfunction main() ...
orexports.main = ...
. - following the docs for Netlify functions here we were expecting either the use of
callback
or a returned promise. - updated the plugin version to fix the env var bindings.
I made these edits on my fork. The URLs for the APIs are accessed via /.netlify/nimbella
or via /api
> curl https://gallant-hawking-22a182.netlify.app/.netlify/nimbella/default/hello
Hello World
> curl https://gallant-hawking-22a182.netlify.app/api/default/hello
Hello World
> curl https://gallant-hawking-22a182.netlify.app/.netlify/nimbella/auth/login
Login
> curl https://gallant-hawking-22a182.netlify.app/api/auth/login
Login