[google-appengine] Re: Auto scaling to basic scaling migrate

2022-05-12 Thread 'Nikhil Patil' via Google App Engine
Any update on this?


On Saturday, May 7, 2022 at 5:49:29 AM UTC+9 Ernesto Contreras Pinon wrote:

> Yes, using the app.yaml file, you can set the type of scaling that is used 
> by your App Engine app. You can specifically see the reference 
> 
>  
> on how the scaling elements are to be syntactically added in your app.yaml 
> file. Since this file contains the specifications for the deployment of 
> your app, it would be the proper place to change the settings. 
>
> Have you recently encountered this issue? There is currently an existing 
> incident  
> that is affecting multiple Google Cloud products which could be related to 
> the errors you are seeing.
> On Friday, May 6, 2022 at 2:36:23 AM UTC-5 nikhilhem...@rakuten.com wrote:
>
>> I was using autoscaling but it has 10 min request timeout,so I want to 
>> change it to basic scaling.
>> Does changing app.yaml will do the thing? or I need more settings.
>> runtime: python39 service: dev-app instance_class: B1 basic_scaling: 
>> max_instances: 10 idle_timeout: 10m
>> I am getting error as
>> The request failed because the instance could not start 
>> successfullyProcess terminated because it failed to respond to the start 
>> request with an HTTP status code of 200-299 or 404.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/3c6e31be-5a88-462b-8541-cacb0d81f6cfn%40googlegroups.com.


[google-appengine] Re: App Engine doesn't send response leads to timeout at client

2022-05-12 Thread 'Nikhil Patil' via Google App Engine
I tried but it seams 
   
   - The dev_appserver tool does not support development of Python 3 apps 
   on Windows.


https://cloud.google.com/appengine/docs/standard/python3/tools/local-devserver-command
On Saturday, May 7, 2022 at 7:22:15 AM UTC+9 Rogelio Monter Rodriguez wrote:

> Have you tried debugging your app locally using the local development 
> server 
> 
>  
> or using the local development server 
> 
> ?
> On Friday, May 6, 2022 at 2:06:58 AM UTC-5 nikhilhem...@rakuten.com wrote:
>
>> To Explain my overall situation, My app response is lost though the API 
>> program executes as expected. This happens randomly.
>>
>> here is my app.yaml
>>
>> #
>> # Copyright 2021 Google LLC
>> #
>> # Licensed under the Apache License, Version 2.0 (the "License");
>> # you may not use this file except in compliance with the License.
>> # You may obtain a copy of the License at
>> #
>> # http://www.apache.org/licenses/LICENSE-2.0
>> #
>> # Unless required by applicable law or agreed to in writing, software
>> # distributed under the License is distributed on an "AS IS" BASIS,
>> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>> # See the License for the specific language governing permissions and
>> # limitations under the License.
>> #
>>
>> # [START django_app]
>> # [START gaestd_py_django_app_yaml]
>>
>> ## std + dev-apc
>> #runtime: python39
>> #service: dev-apc
>> #instance_class: F1
>>
>>
>> handlers:
>> # This configures Google App Engine to serve the files in the app's static
>> # directory.
>> - url: /static
>> static_dir: staticfiles/
>>
>> # This handler routes all requests not caught above to your main app. It 
>> is
>> # required when static routes are defined, but can be omitted (along with
>> # the entire handlers section) when there are no static files defined.
>> - url: /.*
>> script: auto
>> # [END gaestd_py_django_app_yaml]
>> # [END django_app]
>>
>> On Friday, April 22, 2022 at 8:11:55 AM UTC+9 Horace (Cloud Platform 
>> Support) wrote:
>>
>>> Hello
>>>
>>> Since we don't have visibility on your project to check your App Engine 
>>> settings including your yaml file and further use our internal tools to 
>>> find out what is happening, kindly take a look at your configuration such 
>>> as your max instances, idle time out, and scaling. From your log, the 
>>> ‘Quitting on terminated signal’ indicates there is a shutdown of an 
>>> instance [1], it could be that there are no requests hence the instance was 
>>> shutdown and there could be a spike in subsequent requests that the 
>>> instance was not ready to respond since there are no instances available.
>>>
>>> Lastly, kindly take a look at your scaling, do note that there is no 
>>> guaranteed uptime for basic and manual scaling [3]. Due to this behavior, 
>>> if you want a higher Monthly Uptime Percentage, try to configure your 
>>> instance with automatic scaling. You can set the max_instances and 
>>> max_idle_instances to values that better achieve your architecture in the 
>>> app.yaml file [4]
>>>
>>> [1] 
>>> https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#shutdown
>>>
>>> [2] 
>>> https://cloud.google.com/appengine/docs/standard/python3/configuring-warmup-requests
>>>
>>> [3] 
>>> https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_uptime
>>>
>>> [4] 
>>> https://cloud.google.com/appengine/docs/standard/go/config/appref#scaling_elements
>>>
>>>
>>> On Thursday, April 21, 2022 at 10:30:00 AM UTC-4 
>>> nikhilhem...@rakuten.com wrote:
>>>
 I think no issue on application side. I have logged upto last line of 
 my post method and after that is return response. 
 *Code:*

 class myView(generics.ListCreateAPIView):
 permission_classes = (IsAuthenticated,)
 http_method_names = ['get', 'post']
 search_fields = ['some', 'thing', 'here'']
 filter_backends = (DynamicSearchFilter,)
 pagination_class = PageNumberPagination
 serializer_class = mySerializer
 queryset = mymodel.objects.all().order_by("-update_date")

 def __init__(self, **kwargs):
 .
 .
 .


 def create(self, request, *args, **kwargs):
 .
 .
 .
 logger.info(f"Returning response of size {len(response_data)}")

 return Response(response_data, content_type='application/json')





 *here are my logs.*[
   {
 "textPayload": "2022-04-14 03:05:21,344 INFO app.myview  create 
  Returning response of size 11",
 "insertId": "62578f71000541533a99d6a0",
 "resource": {
   "type": "gae_app",
   "labels": {
 "project_id": "my-prj",
 "module_id": "myapp",
 "zone": "asia-northeast1-1",
 

[google-appengine] Lost access to Google Cloud groups?

2022-05-12 Thread Sam G
*Could a Googler drop me a line 1:1?* We switched email services and I've 
now lost access to my previous Google Groups :(

I was in a few insiders programs and I owe some feedback, and am hoping to 
get support especially with I/O 2022 coming to a close :). Congrats on all 
the launches, as well!!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/78860332-5cec-4dcc-8405-c944a42a19den%40googlegroups.com.


Re: [google-appengine] How to structure credentials in requests to App Engine App

2022-05-12 Thread 'Ernesto Contreras Pinon' via Google App Engine


Can you share the full stack trace you receive when trying to authenticate? 
It might help clarify the problem. The Google Auth API reference shows that 
you can use the "AuthorizedSession" class to create an authenticated session 

 and 
then use the respective methods 

 
to perform HTTP requests from the authenticated session object.   

Have you tried it that way? AuthorizedSession expects a Credentials 
argument, which is returned 

 from 
the fetch_id_token() method. You can refer to the complete user guide 

 documentation 
for more samples.

On Monday, May 9, 2022 at 1:49:09 PM UTC-5 david.b...@zebra.com wrote:

> Standard environment. Client app->App Engine App->Other services is the 
> logic flow. Client is Python code. I am trying to use the service account 
> key to request a token so that my client app and submit a request to my App 
> Engine App (controller/proxy/etc). Code method below:
>
> from google.auth.transport.requests import Request
> from google.oauth2 import id_token
> import requests
>
>
> def make_iap_request(url, client_id, method='GET', **kwargs):
> """Makes a request to an application protected by Identity-Aware Proxy.
>
> Args:
>   url: The Identity-Aware Proxy-protected URL to fetch.
>   client_id: The client ID used by Identity-Aware Proxy.
>   method: The request method to use
>   ('GET', 'OPTIONS', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE')
>   **kwargs: Any of the parameters defined for the request function:
> 
> https://github.com/requests/requests/blob/master/requests/api.py
> If no timeout is provided, it is set to 90 by default.
>
> Returns:
>   The page body, or raises an exception if the page couldn't be 
> retrieved.
> """
>  # Set the default timeout, if missing
> if 'timeout' not in kwargs:
> kwargs['timeout'] = 90
>
> # Obtain an OpenID Connect (OIDC) token from metadata server or using 
> service
> # account.
> open_id_connect_token = id_token.fetch_id_token(Request(), client_id)
>
> # Fetch the Identity-Aware Proxy-protected URL, including an
> # Authorization header containing "Bearer " followed by a
> # Google-issued OpenID Connect token for the service account.
> resp = requests.request(
> method, url,
> headers={'Authorization': 'Bearer {}'.format(
> open_id_connect_token)}, **kwargs)
> if resp.status_code == 403:
> raise Exception('Service account does not have permission to '
> 'access the IAP-protected application.')
> elif resp.status_code != 200:
> raise Exception(
> 'Bad response from application: {!r} / {!r} / {!r}'.format(
> resp.status_code, resp.headers, resp.text))
> else:
> return resp.text
>
> data={
> On Friday, May 6, 2022 at 11:53:15 AM UTC-5 Osvaldo Lopez Acuña wrote:
>
>> Please share if you’re using the Standard or Flex environment, in which 
>> programming language is your App (including version), what type of service 
>> account you have, any related code or settings that you have tried and the 
>> complete error and logs. Meanwhile here’s the general App Engine’s 
>> Troubleshooting guide 
>> 
>>  
>> where you can find solutions to similar issues. Also, you can check App 
>> Engine connectivity questions 
>> 
>>  
>> and Specifying a service account 
>> .
>>  
>> App Engine lets you use two types of service accounts.
>>
>> On Thursday, May 5, 2022 at 7:03:24 PM UTC-5 
>> anat...@newventurevisions.com wrote:
>>
>>> Usually you need to call google api to get token using your service 
>>> account key. Then use token in https request header.
>>> It does depend on how your app engine app is configured though in terms 
>>> of authentication.
>>>
>>> Sincerely,
>>> Anatoli Trifonov
>>>
>>>
>>>
>>>
>>> On Thu, May 5, 2022 at 12:06 AM 'David Brogdon' via Google App Engine <
>>> google-a...@googlegroups.com> wrote:
>>>
 I am trying to figure out how to authenticate a desktop app to my App 
 Engine app in order to send HTTP requests to my App Engine App. I have 
 read 
 all the documentation I can find but what I really need to know is, *how