Comments (3)
The default function is function
. See https://github.com/GoogleCloudPlatform/functions-framework#specification-summary
You need to provide the --target
flag to specify either foo
or bar
from functions-framework-dart.
I've tried setting up a simple experiment with two functions, foo
and bar
. Nothing fancy.
@CloudFunction()
Response foo(Request request) => Response.ok('Hello, World! (foo)');
@CloudFunction()
Response bar(Request request) => Response.ok('Hello, World! (bar)');
The server.dart
got generated correctly, indicating that this is supported.
FunctionTarget? _nameToFunctionTarget(String name) {
switch (name) {
case 'foo':
return FunctionTarget.http(
function_library.foo,
);
case 'bar':
return FunctionTarget.http(
function_library.bar,
);
default:
return null;
}
}
But after building a container using the provided Dockerfile
, it fails to start:
$ docker container run --name my-container-1 -p 8081:8080 my-image-1
There is no handler configured for FUNCTION_TARGET `function`.
How can I build (& deploy to the Cloud Run, preferably) such trivial two-functions package?
from functions-framework-dart.
@kevmoo Thank you very much for your answer, but please be aware that from my perspective this issue is not closed.
Thank you for a link to the functions-framework project. Would you point me to the place in the functions-framework-dart project that states that these two projects are interconnected? I can see that the names are similar and I can guess the relationship between them, but stating such relationship in the readme / docs is necessary, in my opinion. I wouldn't know how the functions-framework-dart user is expected to guess that they should look for information in the functions-framework#specification-summary
document.
I might should have noted, that such direct docker container run
invocation was just a "MCVE". I don't intend to invoke this code in such way. In a real life scenario, a similar (cryptic, for me) message was buried deeply in a Cloud Run logs, when my container exploded during start-up.
I'll also repeat the questions from my original posts.
Am I correct to assume that the intended usage (of functions-framework-dart) is similar to the official Firebase Functions JavaScript SDK, where you can define dozens of functions in the single file?
Should I conclude that the answer is "yes"?
How can I build (& deploy to the Cloud Run, preferably) such trivial two-functions package?
Does the provided Dockerfile
, which is picked up by gcloud beta run deploy
command as per Quickstart: Cloud Run docs support a project with multiple functions (or, in other words, multiple functions with non-default names)?
Am I right to assume that if I have multiple functions in my functions-framework-dart -based project, I'll need a separate Cloud Run service per single in-code @CloudFunction()
?
from functions-framework-dart.
Related Issues (20)
- Docker build failing HOT 8
- Error Reporting in Cloud Run HOT 4
- sample project created via dartfn should use official docker images HOT 3
- Docker files created by dartfn doesn't copy runtime files, causing launch to fail HOT 3
- dartfn-generated project fails tests locally HOT 9
- dartfn: need to have a dependency to pkg:lints!
- dartfn: gitignore files should link to https://dart.dev/guides/libraries/private-files
- Cloud Run + Cloud SQL hanging issue HOT 25
- Pricing and/or other considerations regarding using Cloud Run for simulating Cloud Functions?
- Docker images failing when deployed to cloud run when using apple silicon HOT 1
- Private SSH packages HOT 1
- Generated project (from dartfn) logs CloudEvent awkwardly HOT 3
- Allow Configuring "X-Powered-By" of underlying shelf server HOT 1
- Support for Protobufs in CloudEvents HOT 6
- Provide access to an instance's region from metadata HOT 1
- gcp: logging does not support jsonPayload HOT 1
- DRY up finishServerTest code and similar HOT 2
- Multiple funcitons in one project HOT 3
- BuildRunner seems to break the code HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from functions-framework-dart.