Google Cloud Endpoints + Firebase Auth: method_info is not set

后端 未结 4 1776
一整个雨季
一整个雨季 2021-01-15 17:15

So I am running the sample code provided by Google:

package com.neat.backend;
/**
 * An endpoint class we are exposing
 */
@Api(
        name = \"myApi\",
           


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-15 17:41

    @Kevendra's answer highlights that this issue can be caused if an openapi.json file is missing a reference to the endpoint API method. Firebase may be using this to reference and discover the API method.

    From the Google OpenAPI Overview:

    Basic structure of an OpenAPI document:

    An OpenAPI document describes the surface of your REST API, and defines information such as:

    The name and description of the API. The individual endpoints (paths) in the API. How the callers are authenticated.

    Follow these steps to regenerate and deploy the openapi.json file:


    generate:

    $ mvn clean package endpoints-framework:openApiDocs -DskipTests
    
    • mvn clean - run a Maven goal to clean your project. package - compile and package it
    • endpoints-framework:openApiDocs generate OpenAPI documents. This will generate the openapi.json file at the location: target/openapi-docs/openapi.json- see generating and deploying an api configuration.
    • -DskipTests skips running any tests, to avoid any test failure due to the openapi.json not yet being generated

    deploy:

    (As a precaution you can first validate the project ID returned from the following command to make sure that the service isn't created in the wrong project - gcloud config list project)

      $ gcloud endpoints services deploy target/openapi-docs/openapi.json
    

    Deploys the openapi.json file from its generated location (in the 'generate' step above). See the Google docs on Deploying the OpenAPI document

提交回复
热议问题