Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interface conversion: http.http2StreamError is not http.http2writeFramer: missing method writeFrame #3

Open
brunocalza opened this issue May 17, 2017 · 0 comments

Comments

@brunocalza
Copy link

Getting this error when trying to use event bucket and then read the contents from Cloud Storage.

panic: interface conversion: http.http2StreamError is not http.http2writeFramer: missing method writeFrame

goroutine 1 [running]:
plugin.lastmoduleinit(0xcce400, 0xc42000e038, 0xccf470, 0x4c, 0xb8fde0)
        /usr/local/go/src/runtime/plugin.go:60 +0x5e6
plugin.open(0x7ffc13527e00, 0xc, 0x0, 0x0, 0x0)
        /usr/local/go/src/plugin/plugin_dlopen.go:72 +0x25d
plugin.Open(0x7ffc13527e00, 0xc, 0xb, 0x8154e8, 0xc)
        /usr/local/go/src/plugin/plugin.go:30 +0x35
main.main()

This panic occurs when I instantiate a new client from cloud storage

ctx := context.Background()
client, err := storage.NewClient(ctx)

Here's the full code

package main

import (
	"context"
	"fmt"
	"io/ioutil"
	"log"

	"cloud.google.com/go/storage"
	"github.com/kelseyhightower/google-cloud-functions-go/event"
)

func F(e event.ObjectChange) (string, error) {
	log.SetFlags(0)

	log.Printf("processing object: %s", e.Data.Id)
	log.Printf("bucket: %s", e.Data.Bucket)
	log.Printf("filename: %s", e.Data.Name)
	log.Printf("resource state: %s", e.Data.ResourceState)

	ctx := context.Background()
	client, err := storage.NewClient(ctx)
	if err != nil {
		log.Fatal(err)
	}
	rc, err := client.Bucket(e.Data.Bucket).Object(e.Data.Name).NewReader(ctx)
	if err != nil {
		log.Fatal(err)
	}
	contents, err := ioutil.ReadAll(rc)
	rc.Close()
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("file contents:", contents)

	return "", nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant