Gcp app engine flex endpoints openapi CORS











up vote
2
down vote

favorite
1












Having an error while trying to send OPTIONS to server.
The error:



{
"code": 7,
"message": "The service does not allow CORS traffic.",
"details": [
{
"@type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": ,
"detail": "service_control"
}
]
}


I get a normal response if I send GET request (throught postman).



The node server uses KOA.js with cors enabled



app.use(cors());


it works without endpoints, so I don't think there could be a problem in server.



app.yaml



runtime: nodejs
env: flex

env_variables:
NODE_ENV: "dev"

handlers:
- url: /
static_dir: /
http_headers:
Access-Control-Allow-Origin: '*'

endpoints_api_service:
name: ******.appspot.com
rollout_strategy: managed


openapi-appengine.yaml



swagger: "2.0"
info:
description: "A simple Google Cloud Endpoints API example."
title: "Endpoints Example"
version: "1.0.0"
host: "******.appspot.com"
x-google-endpoints:
- name: "******.appspot.com"
allowCors: "true"
x-google-allow: all

paths:
/api/user:
get:
operationId: "getcurrentuser"
produces:
- "application/json"
parameters:
responses:
200:
description: "successful operation"
schema:
type: "object"
security:
- firebase:

securityDefinitions:
firebase:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
x-google-issuer: "https://securetoken.google.com/******"
x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
x-google-audiences: "******,******"









share|improve this question


























    up vote
    2
    down vote

    favorite
    1












    Having an error while trying to send OPTIONS to server.
    The error:



    {
    "code": 7,
    "message": "The service does not allow CORS traffic.",
    "details": [
    {
    "@type": "type.googleapis.com/google.rpc.DebugInfo",
    "stackEntries": ,
    "detail": "service_control"
    }
    ]
    }


    I get a normal response if I send GET request (throught postman).



    The node server uses KOA.js with cors enabled



    app.use(cors());


    it works without endpoints, so I don't think there could be a problem in server.



    app.yaml



    runtime: nodejs
    env: flex

    env_variables:
    NODE_ENV: "dev"

    handlers:
    - url: /
    static_dir: /
    http_headers:
    Access-Control-Allow-Origin: '*'

    endpoints_api_service:
    name: ******.appspot.com
    rollout_strategy: managed


    openapi-appengine.yaml



    swagger: "2.0"
    info:
    description: "A simple Google Cloud Endpoints API example."
    title: "Endpoints Example"
    version: "1.0.0"
    host: "******.appspot.com"
    x-google-endpoints:
    - name: "******.appspot.com"
    allowCors: "true"
    x-google-allow: all

    paths:
    /api/user:
    get:
    operationId: "getcurrentuser"
    produces:
    - "application/json"
    parameters:
    responses:
    200:
    description: "successful operation"
    schema:
    type: "object"
    security:
    - firebase:

    securityDefinitions:
    firebase:
    authorizationUrl: ""
    flow: "implicit"
    type: "oauth2"
    x-google-issuer: "https://securetoken.google.com/******"
    x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
    x-google-audiences: "******,******"









    share|improve this question
























      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      Having an error while trying to send OPTIONS to server.
      The error:



      {
      "code": 7,
      "message": "The service does not allow CORS traffic.",
      "details": [
      {
      "@type": "type.googleapis.com/google.rpc.DebugInfo",
      "stackEntries": ,
      "detail": "service_control"
      }
      ]
      }


      I get a normal response if I send GET request (throught postman).



      The node server uses KOA.js with cors enabled



      app.use(cors());


      it works without endpoints, so I don't think there could be a problem in server.



      app.yaml



      runtime: nodejs
      env: flex

      env_variables:
      NODE_ENV: "dev"

      handlers:
      - url: /
      static_dir: /
      http_headers:
      Access-Control-Allow-Origin: '*'

      endpoints_api_service:
      name: ******.appspot.com
      rollout_strategy: managed


      openapi-appengine.yaml



      swagger: "2.0"
      info:
      description: "A simple Google Cloud Endpoints API example."
      title: "Endpoints Example"
      version: "1.0.0"
      host: "******.appspot.com"
      x-google-endpoints:
      - name: "******.appspot.com"
      allowCors: "true"
      x-google-allow: all

      paths:
      /api/user:
      get:
      operationId: "getcurrentuser"
      produces:
      - "application/json"
      parameters:
      responses:
      200:
      description: "successful operation"
      schema:
      type: "object"
      security:
      - firebase:

      securityDefinitions:
      firebase:
      authorizationUrl: ""
      flow: "implicit"
      type: "oauth2"
      x-google-issuer: "https://securetoken.google.com/******"
      x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
      x-google-audiences: "******,******"









      share|improve this question













      Having an error while trying to send OPTIONS to server.
      The error:



      {
      "code": 7,
      "message": "The service does not allow CORS traffic.",
      "details": [
      {
      "@type": "type.googleapis.com/google.rpc.DebugInfo",
      "stackEntries": ,
      "detail": "service_control"
      }
      ]
      }


      I get a normal response if I send GET request (throught postman).



      The node server uses KOA.js with cors enabled



      app.use(cors());


      it works without endpoints, so I don't think there could be a problem in server.



      app.yaml



      runtime: nodejs
      env: flex

      env_variables:
      NODE_ENV: "dev"

      handlers:
      - url: /
      static_dir: /
      http_headers:
      Access-Control-Allow-Origin: '*'

      endpoints_api_service:
      name: ******.appspot.com
      rollout_strategy: managed


      openapi-appengine.yaml



      swagger: "2.0"
      info:
      description: "A simple Google Cloud Endpoints API example."
      title: "Endpoints Example"
      version: "1.0.0"
      host: "******.appspot.com"
      x-google-endpoints:
      - name: "******.appspot.com"
      allowCors: "true"
      x-google-allow: all

      paths:
      /api/user:
      get:
      operationId: "getcurrentuser"
      produces:
      - "application/json"
      parameters:
      responses:
      200:
      description: "successful operation"
      schema:
      type: "object"
      security:
      - firebase:

      securityDefinitions:
      firebase:
      authorizationUrl: ""
      flow: "implicit"
      type: "oauth2"
      x-google-issuer: "https://securetoken.google.com/******"
      x-google-jwks_uri: "https://www.googleapis.com/service_accounts/v1/metadata/x509/securetoken@system.gserviceaccount.com"
      x-google-audiences: "******,******"






      firebase google-app-engine cors google-cloud-endpoints






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 8 at 7:32









      RaShe

      81421636




      81421636
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          What path did you use when sending OPTIONS? "/" or "/api/user"?



          From your Swagger, you only setup "/api/user" path so OPTIONS only works for that path.






          share|improve this answer








          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
            – Simply Ged
            Nov 10 at 2:25











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203153%2fgcp-app-engine-flex-endpoints-openapi-cors%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          What path did you use when sending OPTIONS? "/" or "/api/user"?



          From your Swagger, you only setup "/api/user" path so OPTIONS only works for that path.






          share|improve this answer








          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
            – Simply Ged
            Nov 10 at 2:25















          up vote
          0
          down vote













          What path did you use when sending OPTIONS? "/" or "/api/user"?



          From your Swagger, you only setup "/api/user" path so OPTIONS only works for that path.






          share|improve this answer








          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
            – Simply Ged
            Nov 10 at 2:25













          up vote
          0
          down vote










          up vote
          0
          down vote









          What path did you use when sending OPTIONS? "/" or "/api/user"?



          From your Swagger, you only setup "/api/user" path so OPTIONS only works for that path.






          share|improve this answer








          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          What path did you use when sending OPTIONS? "/" or "/api/user"?



          From your Swagger, you only setup "/api/user" path so OPTIONS only works for that path.







          share|improve this answer








          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered Nov 10 at 1:48









          Wayne Zhang

          1




          1




          New contributor




          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Wayne Zhang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.












          • Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
            – Simply Ged
            Nov 10 at 2:25


















          • Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
            – Simply Ged
            Nov 10 at 2:25
















          Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
          – Simply Ged
          Nov 10 at 2:25




          Welcome to Stack Overflow. This is not an answer to the question but more of a comment. Please take a look at How to Answer to understand when to provide an answer and when to add a comment.
          – Simply Ged
          Nov 10 at 2:25


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203153%2fgcp-app-engine-flex-endpoints-openapi-cors%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word