Skip to content

Instantly share code, notes, and snippets.

@gidich

gidich/index.js Secret

Last active January 14, 2021 19:12
Show Gist options
  • Save gidich/6435301b7aa7dea4485f4e5400536319 to your computer and use it in GitHub Desktop.
Save gidich/6435301b7aa7dea4485f4e5400536319 to your computer and use it in GitHub Desktop.
dapr issue
const express = require("express");
const app = express();
var json = express.json;
app.use(json());
const daprPort = process.env.DAPR_HTTP_PORT //--dapr-http-port
const port = 4000 //--app-port
app.get('/healthcheck',(_, res) => {
res.send({ app: 'testapp', status: 'healthy' });
console.log('healthcheck');
});
app.listen(port, () => console.log(`Service on port:${port}; DAPR listening on: ${daprPort}!`));
/*
dapr run --app-id testapp --app-port 4000 --dapr-http-port 4400 node index.js
results:
....
INFO[0000] app id: testapp app_id=testapp
....
INFO[0000] application discovered on port 4000 app_id=testapp ...
INFO[0000] application configuration loaded app_id=testapp ...
INFO[0000] actor runtime started. actor idle timeout: 1h0m0s. actor scan interval: 30s app_id=testapp ...
INFO[0000] dapr initialized. Status: Running. Init Elapsed 195.878ms app_id=testapp ...
INFO[0000] placement tables updated, version: 0 app_id=testapp ...
http://localhost:4000/healthcheck
result: {"app":"testapp","status":"healthy"}
http://localhost:4400/v1.0/invoke/testapp/method/healthcheck
result: {"errorCode":"ERR_DIRECT_INVOKE","message":"fail to invoke, id: testapp, err: couldn't find service: testapp"}
..V0.11
dapr invokeGet --app-id testapp --method healthcheck
result {"errorCode":"ERR_DIRECT_INVOKE","message":"couldn't find service: testapp"}
..V1b2
dapr invoke --app-id testapp --method healthcheck --verb GET
result: {"errorCode":"ERR_DIRECT_INVOKE","message":"fail to invoke, id: testapp, err: couldn't find service: testapp"}*/
@gidich
Copy link
Author

gidich commented Jan 14, 2021

Service Startup Output w v0.11.3

`
Patricks-MacBook-Pro:d1 patrick$ dapr run --app-id testapp --app-port 4000 --dapr-http-port 4400 node index.js
ℹ️ Starting Dapr with id testapp. HTTP Port: 4400. gRPC Port: 53078
== DAPR == time="2021-01-14T13:41:13.290085-05:00" level=info msg="starting Dapr Runtime -- version 0.11.3 -- commit a1a8e11" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.290139-05:00" level=info msg="log level set to: info" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.290302-05:00" level=info msg="metrics server started on :53079/" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.metrics type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.291139-05:00" level=info msg="standalone mode configured" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.291155-05:00" level=info msg="app id: testapp" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.291168-05:00" level=info msg="mTLS is disabled. Skipping certificate request and tls validation" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.291181-05:00" level=info msg="application protocol: http. waiting on port 4000. This will block until the app is listening on that port." app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== APP == Service on port:4000; DAPR listening on: 4400!

== DAPR == time="2021-01-14T13:41:13.444357-05:00" level=info msg="application discovered on port 4000" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.453127-05:00" level=info msg="application configuration loaded" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.453731-05:00" level=info msg="local service entry announced: testapp -> 192.168.1.226:53083" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.contrib type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.453826-05:00" level=info msg="Initialized name resolution to standalone" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.460425-05:00" level=info msg="component loaded. name: pubsub, type: pubsub.redis" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.464487-05:00" level=info msg="component loaded. name: statestore, type: state.redis" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.464589-05:00" level=info msg="waiting for all outstanding components to be processed" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.464672-05:00" level=info msg="component loaded. name: zipkin, type: exporters.zipkin" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.464694-05:00" level=info msg="all outstanding components processed" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.464981-05:00" level=info msg="actor runtime started. actor idle timeout: 1h0m0s. actor scan interval: 30s" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.46508-05:00" level=info msg="starting connection attempt to placement service: localhost:50005" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465143-05:00" level=info msg="enabled gRPC tracing middleware" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.grpc.api type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465217-05:00" level=info msg="API gRPC server is running on port 53078" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.46529-05:00" level=info msg="enabled gRPC tracing middleware" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.grpc.internal type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465339-05:00" level=info msg="internal gRPC server is running on port 53083" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465574-05:00" level=info msg="enabled cors http middleware" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.http type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465614-05:00" level=info msg="enabled tracing http middleware" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.http type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465648-05:00" level=info msg="http server is running on port 4400" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.465672-05:00" level=info msg="dapr initialized. Status: Running. Init Elapsed 174.52599999999998ms" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.468557-05:00" level=info msg="established connection to placement service at localhost:50005" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.470302-05:00" level=info msg="placement order received: lock" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.470418-05:00" level=info msg="placement order received: update" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.470443-05:00" level=info msg="placement tables updated, version: 0" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

== DAPR == time="2021-01-14T13:41:13.470462-05:00" level=info msg="placement order received: unlock" app_id=testapp instance=Patricks-MacBook-Pro.local scope=dapr.runtime.actor type=log ver=0.11.3

ℹ️ Updating metadata for app command: node index.js
✅ You're up and running! Both Dapr and your app logs will appear here.

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment