Giter VIP home page Giter VIP logo

Comments (10)

iangudger avatar iangudger commented on May 27, 2024

There are no known issues that would cause this. Are you sure that it isn't a bug in your app?

from cloud-functions-go.

montanaflynn avatar montanaflynn commented on May 27, 2024

I never get the error when testing with (make test) or making the handler from the golang net/http server. I did find a similar issue: firebase/functions-samples#78 but that's for javascript.

My handler encodes a png image and writes it to http.ResponseWriter, here's the entire app.

Here is more error information from the logs:

Function execution took 284 ms, finished with status: 'connection error'

from cloud-functions-go.

iangudger avatar iangudger commented on May 27, 2024

Can you try removing the use of the nodego logger and see if that fixes the problem?

By the way, when you add the logging back, you should add the nodego.WithLoggerFunc middleware. That way your logs will get associated with the request that triggered them. See examples/logging.go.

from cloud-functions-go.

montanaflynn avatar montanaflynn commented on May 27, 2024

Removing the nodego logger does seem to fix the issue.

The problem remains even when using the nodego.WithLoggerFunc middleware. When using the middleware should I not use nodego.ErrorLogger.Println(err)? If I use Go's std log then I miss out on the error / info abstraction.

from cloud-functions-go.

montanaflynn avatar montanaflynn commented on May 27, 2024

Nevermind the problem remains even without the logs, just took over a hundred requests before it happened.

https://gist.github.com/montanaflynn/bb002f8212e9cc7f75af5cc03e7a5fd8

...
HTTP/1.1 200     3.66 secs:    7742 bytes ==> GET  /img-without-logs
HTTP/1.1 500     3.68 secs:      36 bytes ==> GET  /img-without-logs
HTTP/1.1 200     0.84 secs:    7742 bytes ==> GET  /img-without-logs
...

from cloud-functions-go.

montanaflynn avatar montanaflynn commented on May 27, 2024

I removed any third party packages and can reproduce with standard library:

This code returns the error / 500 response every so often.
This code does not return an error / 500 response afaik.

The difference in the code that doesn't return an error is I removed all the nodego logger code including init nodego.OverrideLogger() and nodego.WithLoggerFunc middleware wrapper.

from cloud-functions-go.

iangudger avatar iangudger commented on May 27, 2024

It seems that the problem could still be logging as you include nodego.OverrideLogger() in the problematic one, but not the non-problematic one.

from cloud-functions-go.

iangudger avatar iangudger commented on May 27, 2024

By the way, you can use nodego.ErrorLogger with nodego.WithLoggerFunc. Maybe we need to clarify the documentation.

from cloud-functions-go.

marcelogrsp avatar marcelogrsp commented on May 27, 2024

Hi all, I am getting the same error.
It works when Testing but doesn't work when I send HTTP POST request.
Actually it works via POST request after I send 3 or more requests.

from cloud-functions-go.

iangudger avatar iangudger commented on May 27, 2024

Cloud Functions now has official Go support:
https://cloud.google.com/functions/docs/quickstart#functions-update-install-gcloud-go

As a result, this repository is no longer under active development. Pull requests are still welcome though.

from cloud-functions-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.