我試着在本地運行pubsub模擬器並使用我在pubsub上運行的現有服務向其發送消息。郵件沒有收到,我得到的只是日誌中的auth錯誤。GCloud pubsub模擬器不尊重「PUBSUB_EMULATOR_HOST」環境變量
[pubsub] Jan 22, 2017 3:43:16 PM com.google.cloud.iam.testing.v1.shared.authorization.AuthInterceptor interceptCall
[pubsub] INFO: Authentication interceptor: Header value is null
[pubsub] Jan 22, 2017 3:43:16 PM com.google.cloud.iam.testing.v1.shared.authorization.AuthInterceptor interceptCall
[pubsub] INFO: Authentication interceptor: invalid or missing token
我正在請求發佈和從dotnet和nodejs拉。
C#
var creds = GoogleCredential.GetApplicationDefaultAsync().Result;
if (creds.IsCreateScopedRequired) {
creds = creds.CreateScoped(new [] { PubsubService.Scope.Pubsub });
}
return new PubsubService(
new BaseClientService.Initializer() {
HttpClientInitializer = creds,
ApplicationName = "My Wonderful App"
}
);
的NodeJS
var pubsub = require('@google-cloud/pubsub');
var pubsubClient = pubsub({
projectId: config.get('GCLOUD_PROJECT')
});