I'm not going to use other module like request, how about writing this with http,
What should I consider while seeding post to browserid?
error:
$ coffee server.coffee
info - socket.io started
to send
to write
end?
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: getaddrinfo ENOENT
at errnoException (dns.js:31:11)
at Object.onanswer [as oncomplete] (dns.js:140:16)
source:
ll = console.log
fs = require 'fs'
page = fs.readFileSync 'page.html', 'utf-8'
query = require 'querystring'
client = fs.readFileSync 'client.coffee', 'utf-8'
page = page.replace '###', client
handler = (req, res) ->
res.writeHead 200, 'Content-Type': 'text/html'
res.end page
http = require 'http'
app = http.createServer handler
app.listen 8000
io = (require 'socket.io').listen app
io.set 'log level', 1
io.sockets.on 'connection', (socket) ->
socket.emit 'ready', 'go'
socket.on 'assertion', (data) ->
msg = query.stringify
assertion: data
audience: 'localhost:8000'
options =
host: 'https://browserid.org'
path: '/verify'
method: 'POST'
headers:
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Length': msg.length
ll 'to send'
request = http.request options, (response) ->
str = ''
ll 'prepare'
response.on 'data', (chunk) ->
str += chunk
ll str
response.on 'end', ->
ll str
request.write msg
ll 'to write'
request.end()
ll 'end?'
with long-stack-traces:
$ coffee server.coffee
info - socket.io started
to send
to write
end?
Uncaught Error: getaddrinfo ENOENT
at errnoException (dns.js:31:11)
at Object.onanswer [as oncomplete] (dns.js:140:16)
----------------------------------------
at EventEmitter.on
at Array.<anonymous> (http.js:1147:12)
at EventEmitter._tickCallback (node.js:192:40)
----------------------------------------
at EventEmitter.nextTick
at ClientRequest.onSocket (http.js:1115:11)
at Agent.addRequest (http.js:938:9)
at new ClientRequest (http.js:1068:16)
at Object.request (http.js:1331:10)
at Socket.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:52:22)
at Socket.$emit (events.js:67:17)
at SocketNamespace.handlePacket (/usr/lib/nodejs/socket.io/lib/namespace.js:335:22)
----------------------------------------
at EventEmitter.on
at SocketNamespace.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:37:19)
at SocketNamespace.$emit (events.js:88:20)
at connect (/usr/lib/nodejs/socket.io/lib/namespace.js:292:10)
at /usr/lib/nodejs/socket.io/lib/namespace.js:308:13
at SocketNamespace.authorize (/usr/lib/nodejs/socket.io/lib/namespace.js:252:5)
at SocketNamespace.handlePacket (/usr/lib/nodejs/socket.io/lib/namespace.js:302:14)
at Manager.handleClient (/usr/lib/nodejs/socket.io/lib/manager.js:669:30)
----------------------------------------
at EventEmitter.on
at Object.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:35:14)
at Object.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:71:4)
at Module._compile (module.js:441:26)
at Object.run (/usr/lib/nodejs/coffee-script/lib/coffee-script/coffee-script.js:68:25)
at /usr/lib/nodejs/coffee-script/lib/coffee-script/command.js:135:29
at /usr/lib/nodejs/coffee-script/lib/coffee-script/command.js:110:18
at [object Object].<anonymous> (fs.js:115:5)
at [object Object].emit (events.js:64:17)
Uncaught undefined
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Looking at the http.request documentation, we find:
Options:
host: A domain name or IP address of the server to issue the request to. Defaults to 'localhost'.
hostname: To support url.parse() hostname is preferred over host
port: Port of remote server. Defaults to 80.
You might try these options instead:
options =
hostname: 'browserid.org'
port: 443
path: '/verify'
method: 'POST'
headers:
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Length': msg.length
Edit: http.request doesn't work for SSL requests, for this, you need to use https.request. Changing to that fixes your other error as well, and the default port is 443 so you can omit that from the options if you wish.
Related
I configured remote S3 logging with the following variables:
- name: AIRFLOW__LOGGING__REMOTE_LOGGING
value: 'True'
- name: AIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDER
value: 's3://my-airflow/airflow/logs'
- name: AIRFLOW__LOGGING__REMOTE_LOG_CONN_ID
value: 'my_s3'
- name: AIRFLOW__LOGGING__LOGGING_LEVEL
value: 'ERROR'
- name: AIRFLOW__LOGGING__ENCRYPT_S3_LOGS
value: 'False'
So far the log files are created with the DAG and task path with the name attempt=1.log or similar but always with 0 bytes size (empty). When I try to see the logs from Airflow I get this message (I'm using the KubernetesExecutor):
*** Falling back to local log
*** Trying to get logs (last 100 lines) from worker pod ***
*** Unable to fetch logs from worker pod ***
(400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Audit-Id': 'f3e0dd67-c8f4-42fc-945f-95dc42e8c2b5', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'Date': 'Mon, 01 Aug 2022 13:07:07 GMT', 'Content-Length': '136'})
HTTP response body: b'{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"name must be provided","reason":"BadRequest","code":400}\n'
Why are my logs files empty?
I've been working with Symfony 2.7 and the RabbitMQBundle to handle some long processes asynchronously.
After facing the issue where the MySQL connection dies after a few minutes, I discovered rabbitmq-cli-consumer, a small app in Go that takes care of consuming the queue, and gives its content to a command.
In my case, I use it with this command: ./rabbitmq-cli-consumer -c configuration-stock.conf --include -V -e 'php app/console amqp:consume:stock --env=prod -vvv', with this configuration file:
[rabbitmq]
host = HOST
username = USERNAME
password = PASSWORD
vhost=/VHOST
port=PORT
queue=stock
compression=Off
[exchange]
name=exports
type=direct
durable=On
[queuesettings]
routingkey=stock
messagettl=10000
deadLetterExchange=exports.dl
deadLetterroutingkey=stock
priority=10
To handle errors, I intend to use RabbitMQ's x-dead-letter-exchange and x-dead-letter-routing-key configuration, to be able to retry the message later (in case something went temporarly wrong).
My issue is that, when I define my queues in RabbitMQBundle's configuration, rabbitmq-cli-consumer is unable to consume the queue, throwing this error:
2018/04/23 11:35:54 Connecting RabbitMQ...
2018/04/23 11:35:54 Connected.
2018/04/23 11:35:54 Opening channel...
2018/04/23 11:35:54 Done.
2018/04/23 11:35:54 Setting QoS...
2018/04/23 11:35:54 Succeeded setting QoS.
2018/04/23 11:35:54 Declaring queue "stock"...
2018/04/23 11:35:54 Registering consumer...
2018/04/23 11:35:54 failed to register a consumer: Exception (504) Reason: "channel/connection is not open"
Here is the configuration I use for RabbitMQBundle:
old_sound_rabbit_mq:
producers:
exports:
connection: default
exchange_options:
name: 'exports'
type: direct
exports_dl:
connection: default
exchange_options:
name: 'exports.dl'
type: direct
consumers:
stock_dead_letter:
connection: default
exchange_options:
name: exports.dl
type: direct
queue_options:
name: stock.dl
routing_keys:
- stock
arguments:
x-dead-letter-exchange: ['S', 'exports']
x-dead-letter-routing-key: ['S', 'stock']
x-message-ttl: ['I', 60000]
callback: amqp.consumers.exports.stock
multiple_consumers:
exports:
connection: default
exchange_options:
name: 'exports'
type: direct
queues:
stock:
name: stock
callback: amqp.consumers.exports.stock
routing_keys:
- stock
arguments:
x-dead-letter-exchange: ['S', 'exports.dl']
x-dead-letter-routing-key: ['S', 'stock']
Has anyone ever encountered something similar ? And how did you solve it ?
I am testing my meteor app's UI with some browser tests. I use http://webdriver.io and a selenium chrome https://hub.docker.com/r/selenium/standalone-chrome/ node.
I use the webdriver.io testrunner for tests and mocha as the test framework.
When I enter this block inside a jade template (by opening the corresponding page):
Template.boardBody.onRendered(function() {
let imagePath = new ReactiveVar('');
this.autorun(() => {
imagePath.set(Meteor.settings.public.backgroundPath[1]);
//document.getElementsByClassName('board-wrapper')[0].style.backgroundImage = "url('" + imagePath.get() + "')";
$('.board-wrapper').css('background-image', "url('" + path + "')");
});
}
The headless chrome crashes with this error:
{ Error: An unknown server-side error occurred while processing the command.
at BoardPage.open (tests/board.page.js:20:5)
at Context.<anonymous> (tests/board.test.js:22:17)
at Promise.F (node_modules/core-js/library/modules/_export.js:35:28)
at execute(<Function>) - at BoardPage.open (tests/page.js:11:13)
message: 'unknown error: session deleted because of page crash\nfrom tab crashed',
type: 'RuntimeError',
screenshot: 'Just a black page',
seleniumStack:
{ status: 13,
type: 'UnknownError',
message: 'An unknown server-side error occurred while processing the command.',
orgStatusMessage: 'unknown error: session deleted because of page crash\nfrom tab crashed\n (Session info: chrome=59.0.3071.115)\n (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.4.4-200.fc22.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 4.13 seconds\nBuild info: version: \'3.4.0\', revision: \'unknown\', time: \'unknown\'\nSystem info: host: \'f362d8ab8951\', ip: \'172.17.0.1\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.4.4-200.fc22.x86_64\', java.version: \'1.8.0_131\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver\nCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57), userDataDir=/tmp/.org.chromium.Chromium.NUsUeZ}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=59.0.3071.115, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]\nSession ID: f1e261ec57fde3697e98945af051d236' },
shotTaken: true }
I use chai.expect for my assertion statements and i have a feeling that the promises are somehow messing up the headless chrome.
Anyone knows why this is happening?
When I tried to deploy a function on my local firebase emulator, I got this error
ERROR: Function load error: Code could not be loaded.
ERROR: Does the file exists? Is there a syntax error in your code?
ERROR: Detailed stack trace: /home/krishna/whozoo-firebase-web/functions/node_modules/firebase-functions/lib/config.js:51
throw new Error('Firebase config variables are not available. ' +
Error: Firebase config variables are not available. Please use the latest version of the Firebase CLI to deploy this function.
at init (/home/krishna/whozoo-firebase-web/functions/node_modules/firebase-functions/lib/config.js:51:15)
at Object.config (/home/krishna/whozoo-firebase-web/functions/node_modules/firebase-functions/lib/config.js:29:9)
at Object.<anonymous> (/home/krishna/whozoo-firebase-web/functions/index.js:7:31)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
ERROR: Error: Failed to deploy function.
at exec (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/controller.js:135:18)
at ChildProcess.exithandler (child_process.js:213:5)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Then I retried deploying after removing this particular line of code
admin.initializeApp(functions.config())
My function is deployed successfully but when I hit the endpoint, I end up with this message
{"code": "app/no-app","message": "The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services."}
How can I solve this error?
EDIT
'use strict';
const admin = require('firebase-admin');
const functions = require('firebase-functions');
const register = require('./register');
admin.initializeApp(functions.config());
exports.register = functions.https.onRequest(register.registerHandler);
register.js
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const cors = require('cors')
cors(req, res, () => {
let requestBody = req.body;
admin.auth().createUser({
'email': requestBody.email,
'emailVerified': false,
'password': requestBody.password,
'displayName': requestBody.firstName + '
' +requestBody.lastName
});
});
This is the part of register.js that I believe causes the problem. The rest of the register.js contains the response message.
Instead of this:
admin.initializeApp(functions.config());
Try this:
admin.initializeApp();
Also, put that line before you require your register module.
/etc/nginx/sites-enabled/default:
location /pine {
add_header Access-Control-Allow-Origin http://localhost:6285;
add_header Access-Control-Allow-Credentials true;
access_by_lua_file /home/akuznetsov/auth.lua;
proxy_pass http://localhost:9100;
}
auth.lua (version 1, works fine):
ngx.req.set_header('x-user-id', ngx.var.cookie_sessionid)
auth.lua (version 2, not working):
ngx.req.set_header('x-user-id', 'session:' .. ngx.var.cookie_sessionid)
in /var/log/nginx/error.log i get this error:
2016/04/06 16:13:10 [error] 14183#0: *1 lua entry thread aborted: runtime error: /home/akuznetsov/auth.lua:2: attempt to concatenate field 'cookie_sessionid' (a nil value)
stack traceback:
coroutine 0:
/home/akuznetsov/auth.lua:2: in function </home/akuznetsov/auth.lua:1>, client: 127.0.0.1, server: localhost, request: "OPTIONS /pine HTTP/1.1", host: "localhost", referrer: "http://localhost:6285/chart/kjckCBcG/?pine=http://localhost/pine"
What's wrong with concat?
ngx.var.cookie_sessionid is nil and just as message tell you, you can't concatenate (i.e. ..) that. Provide if check with logic to handle this case or use ngx.req.set_header('x-user-id', 'session:' .. ngx.var.cookie_sessionid or "") if you okay with using empty string as default.