Application with wrong code even after a git force push - node.js

I am under the impression that my application on Bluemix is running an older (wrong) version of the code. I have made several updates and now the application doesn't deploy nor will it start. When I check the log files, I see some errors due to Express middleware changes that are no longer supported and should be replaced by external components, for example, replace bodyParser with body-parser. I have made all these changes replacing express.middlewarename with the new components according to this page: https://github.com/senchalabs/connect#middleware
However, I am still getting error messages in the log file when I try to deploy the application. The message is:
throw new Error('Most middleware (like ' + name + ') is no longer bundled with
Express and must be installed separately. Please see
https://github.com/senchalabs/connect#middleware.');
2017/4/5 午後2時42分48秒 ERR APP at Function.Object.defineProperty.get
(/home/vcap/app/node_modules/express/lib/express.js:107:13)
2017/4/5 午後2時42分48秒 ERR APP at Module._compile (module.js:409:26)
2017/4/5 午後2時42分48秒 ERR APP at Object.Module._extensions..js (module.js:416:10)
2017/4/5 午後2時42分48秒 ERR APP at Module.load (module.js:343:32)
I am able to run the application on my machine. If I download the code from the compile pipeline, it seems fine. However, I see some errors, which point to a line of code that is a comment or a blank line in my files.
All of these issues leads me to believe that Bluemix is trying to deploy a wrong version of code.
Does anyone know how can I fix it?
Thank you in advance.

First you have make sure your all node process is killed.
On linux you can check using : ps aux|grep node.
After that rebuild your npm. using "npm build" command.
Start you server it will work.

You can do a couple of things
1. Add a git commit tag as apart of your end point. Maven and other build tools have this capability and it good practice especially for micro service architectures. Spring has one and I would be surprised if node didn't have something similar. This is what I found with a brief search. [1]
2. Trying doing a cf d ${app_name} then re-push your app.
3. If you're using a manifest file or using the cf p command make sure you specify the path to the application being deployed. There are some other nuances with node on CF but you can also assign start scripts to the build pack when the app is being deployed.
I hope this helps.
[1] https://github.com/ktoso/maven-git-commit-id-plugin/

Related

TFS server error (from Azure DevOps Extension) : Use of const in strict mode

I have Azure DevOps extension which works fine in Azure DevOps and Many TFS versions.However when I perform test in one of random TFS server (TFS 2015) I got an error.
Note : This extension was written in Typescript and use some node modules (npm) in code
I have check whether there is dependency on nodejs installed in TFS server but as per my research this extension runs without any issue even in severs where nodejs not installed. As per the code this error is occurring from the first line of the code where it tries to access another class in separate file.
I suspect this issue is due to some kind of mis-configuration in TFS server.
This is the error I got in TFS console
Set workingFolder to default: C:\Local\Toolset\tasks\smipletest\5.1.5
C:\Local\Toolset\tasks\smipletest\5.1.5\App.js:11
const azore = require('./Azore');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
What could be the possible reason(s) for this issue. And what are the possible remediation steps ?
I was able to find root cause for this issue.
Each TFS agent has it's own node application included inside
agent folder.
Due to this reason irrespective to the which version we installed from outside (to same server), it always access node that installed within TFS agent.
If any file (node.exe or any dependency file) is corrupted it prompt a error message (as shown in
the question)
Hence to resolve this, we have to fix the issue with node that installed within TFS agent. Or easiest option is uninstall current agent , download fresh copy of agent from TFS server. and re-configure agent in the same server.

Launch fails after meteor build

I am creating a build from meteor source in a docker container.
It worked well so far (since last creation 1 or 2 weeks ago) but today an exception raises !
at /home/meteor/build/bundle/programs/server/boot.js:462:11
at /home/meteor/build/bundle/programs/server/boot.js:423:13
at Function.run (/home/meteor/build/bundle/programs/server/profile.js:510:12)
at /home/meteor/build/bundle/programs/server/boot.js:464:5
at Function.time (/home/meteor/build/bundle/programs/server/profile.js:309:28)
TypeError: Object.getOwnPropertyDescriptors is not a function
at insert (packages/mongo/collection.js:435:12)
at packages/autoupdate.js:189:3
at updateVersions (packages/autoupdate.js:125:20)
throw(ex);
/home/meteor/build/bundle/programs/server/node_modules/fibers/future.js:280
NB : log may be not ordered as I use ELK stack to handle it
What happened ? And what to do to solve it ?
FYI: the application works well locally (not builded)
Node 6 is currently default in alpine, that was the issue. I switch to node image which is safer (but bigger).

Kibana 4 configuration for production

I'm trying to deploy Kibana 4 to Azure Websites. I can't use bin/kibanta.bat file since Azure Websites uses start script in package.json to bootstrap application. I tried to update package.json start script to run bin\kibana.js file and environment variables in it. After that Azure starts running Kibana server but I'm getting this error: Uncaught ReferenceError: ZeroClipboard is not defined (http://kibana-site.azurewebsites.net/index.js?_b=5827:89458). Does anyone tried to make Kibana 4 run not using bin\kibana* files? Maybe I have to specify additional environment variables?
The solution is explained here: https://github.com/elastic/kibana/issues/2617
It's a bug that was fixed later.

Compile less files in node.js project on Windows Azure

I have a node.js project that compiles less files to css when I start the app. I do this by modifying the start script in package.json like so:
{
// omitted for brevity
start: { lessc public/stylesheets/styles.less > public/stylesheets/styles.css; node app.js; }
}
This works nicely locally, but not at all on my Windows Azure instance. Either because less needs to be installed globally on the machine for this to work, or because Azure doesn't run npm start. Or both. Either way, I need another solution!
I thought custom deployments was the answer (I'm using git remote deployment) and I tried modifying the deploy.cmd to include
call "lessc public/stylesheets/styles.less > public/stylesheets/styles.css;"
No joy. I even tried
call "%SITE_ROOT%/node_modules/less/bin/lessc %SITE_ROOT%/public/stylesheets/styles.less > %SITE_ROOT%/public/stylesheets/styles.css;
Am I coming at this the wrong way? How can I keep the compiled css files out of my source control and compile them on the server after deployment to Azure?
Thanks!
OK, I finally have this going, I think.
For some reason, even though the physical file is on the disk (I can see them with my FTP client), Azure is not letting me run lessc in the \node_modules\less\bin folder, but it does let me run the version in the \node_modules\.bin folder.
In the end, I added the following lines to my deploy.cmd file, and it worked!
IF NOT DEFINED LESS_COMPILER (
SET LESS_COMPILER=%DEPLOYMENT_TARGET%\node_modules\.bin\lessc
)
call %LESS_COMPILER% %DEPLOYMENT_TARGET%\public\stylesheets\styles.less > %DEPLOYMENT_TARGET%\public\stylesheets\styles.css

Problem with node.js and Redis-server?

I intended to implement a chat feature in my rails application. After a brief backup work I found JUGGERNAUT is the best option. By going to through http://juggernaut.rubyforge.org/
I have successfully implemented the juggernaut in my application.
Presently I'm all set to implement chat feature and after a vigorous surfing over web I couldn't get good tutorial to implement it but I found the some part of implementation at http://www.golygon.com/2010/12/private-chat-room-in-ruby-on-rails-3-0/. I decided to follow it but initially to implement the tutorial we need to have redis server and node.js in our system. I installed both in my environment.
But I'm facing the following problem as follows:
If I try
redis-server, I'm getting the following error
[11440] 08 Aug 10:08:16 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[11440] 08 Aug 10:08:16 # Opening port: bind: Address already in use
and as per the tutorial
if I try
sudo node server.js, I'm getting the following error
[sudo] password for re5:
node.js:63
throw e;
^
Error: ENOENT, No such file or directory '/home/re5/Documents/task17/server.js'
at Object.openSync (fs:153:18)
at Object.readFileSync (fs:94:15)
at Module._loadScriptSync (node.js:468:39)
at Module.loadSync (node.js:338:12)
at Object.runMain (node.js:522:24)
at Array.<anonymous> (node.js:756:12)
at EventEmitter._tickCallback (node.js:55:22)
at node.js:773:9
As I don't know much about the redis and node I'm unable to figure out what was the problem regarding to this errors.
I'm stuck and couldn't go further as I'm not sure whether this two are configured perfectly or not.
currently I'm using rails 3.0.7 and ruby 1.8.7
Can any one help me out.
Well your first error is quite simple to understand.
[11440] 08 Aug 10:08:16 # Opening port: bind: Address already in use
This means that there is aready a server bound to that port and using it as a server, this can happen if you have other applications/servers running or if you try to have mutiple instances of the server run at one time. To fix this you need to stop the process and then start it back up again. You can usually do this by closing all of your terminal windows or using your operating systems process manager to terminate the process, if those methods dont work for you try shutting your computer down and starting it back up. If you are still unable to start the Redis server after this then there are some more steps we can take.
The next error is due to node.js not being able to find a file that it needs. Reinstalling node.js should fix this problem for you.
Let me know if this fixes your problem or if you need more help.

Resources