AWS - Deploying Model

月 15 7月 2019

AWS - Deploying Model ( dealing with problems)

When after all procedure, the server error continues.

  • "Missing Authentication Token"
  • "Internal server error"
  • 500 / 403 error.

Backgrounds

  • I'm not used to deploying / writing html.
  • There may be many errors or changes besides on a state when to try deploying.
  • So I was confused how to solve these errors.
  • Security level is not described here.

Errors I have gotten.

  1. HTML Responce shows
    1. {"message":"Missing Authentication Token"}
    2. {"message": "Internal server error"}
  2. Chrome DevTools Console tab ( Press F12 on chrome browser ) shows
    1. Failed to load resource: the [Expression like Invoke URL] server responded with a status of 500 ()
    2. Access to XMLHttpRequest at [Expression like Invoke URL] from origin 'null' has been blocked by CORS policy: No 'Access-Control-Alllow-Origin' header is present on the requested resource.
    3. POST [Expression like Invoke URL] 500
    4. POST [Expression like Invoke URL] 403

Checkpoints

  1. POST method written properly on html, check if index.html has it on properly.
    • Though this is a basic point, but I am not used to deploy web pages, then I take time to notice this point.
  2. The deployment process, which we must cycling to succeed.
    1. Create an IAM Role for the Lambda function
      • This is ok to reuse, no need to reset on each trial.
    2. Create Lambda function
      • Reset the endpoint name is mandatory on each trial. Check the name by predictor.endpoint on Notebook.
    3. Setting up API Gateway
      • If Lambda function name is same, it may better to recreate API itself to enable changes on Lambda function.
        • I guess when recreate it, it updates the related Lambda function, and changes in Lambda function is enabled.
  3. Do not worry so much about CORS.

    • It will be working that Lambda function code includes below.

      python return { 'statusCode' : 200, 'headers' : { 'Content-Type' : 'text/plain', 'Access-Control-Allow-Origin' : '*' }, 'body' : result } * 'Access-Control-Allow-Origin' : '*' part allows all access.

    • There are articles for CORS, but for me, it is not necessary to success deploying.

    • Do not mix the issue to enable GPU on Notebook.

Reference

social