Search code examples
node.jsamazon-web-serviceshttp-status-code-503

AWS 503 Service Temporarily Unavailable


My front-end connecting to my server which host in AWS, and from yesterday I getting 503 Service Temporarily Unavailable error.

In chrome console I have 2 errors :

1 :

http://myServerendpoint.com/getData 503 (Service Temporarily Unavailable)

2 :

Failed to load http://myServerendpoint.com/getData : No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myFrontEndPoint.com' is therefore not allowed access. The response had HTTP status code 503.

I already apply cors to the server ( it's nodejs ) :

app.use(cors({
   allowedOrigin: ["*"],
   credentials: true
}))

and it was working until yesterday. but from yesterday I keep getting this error and have no clue. in aws logs I getting this :

container_linux.go:247: starting container process caused “exec: \“/usr/bin/node\“: stat /usr/bin/node: no such file or directory”

Any idea what is wrong?

UPDATE :

The path was wrong I change it to correct one which is /usr/bin/node but now I getting permission denied error :

container_linux.go:247: starting container process caused "exec: \"/usr/bin/node\": permission denied"

my docker file :

FROM node:6-onbuild

RUN apt-get update && \
  apt-get -y install sudo

RUN mkdir -p /usr/bin/node
RUN chmod -R +x /usr/bin/node
RUN sudo chown -R $USER: /usr/bin/node
WORKDIR /usr/bin/node

COPY package.json /usr/bin/node
RUN npm install
COPY . /usr/bin/node

ENV PORT 80
EXPOSE ${PORT}

CMD [ "npm","run", "start" ]

NEW Update :

Even after build with buildkite, the duckerfile config run fine :

Removing intermediate container eac44b8f2a3f
Step 3/12 : RUN mkdir -p /usr/bin/node
 ---> Running in 9ac2ac7f960e
 ---> 970134252f9d
Removing intermediate container 9ac2ac7f960e
Step 4/12 : RUN chmod -R +x /usr/bin/node
 ---> Running in 8c54b0e3d813
 ---> 5ca0fe8180f6
Removing intermediate container 8c54b0e3d813
...
...
...
Successfully built 7f189f7e38cc
Successfully tagged 239820024964.dkr.ecr.ap......

So the problem is not before building, its after build, when we send a http request we got this permission denied!


Solution

  • We find the problem, in case if someone needed, in my case, our ecs task EntryPoint had a different path for the node, basickly our docker node path located on : /usr/local/bin/node BUT our ecs task entrypoint was set to /usr/bin/node