Skip to content

logging: panic in resource dection for Cloud Functions #3990

@someone1

Description

@someone1

Client

Logging

Environment

Go 1.13 on Cloud Functions

Updating only the dependency in our project resulted in this panic for our Cloud Function

panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
functions/vendor/cloud.google.com/go/logging.regionFromZone(...)
	/workspace/src/functions/vendor/cloud.google.com/go/logging/logging.go:407
functions/vendor/cloud.google.com/go/logging.detectCloudFunction(0x1379001)
	/workspace/src/functions/vendor/cloud.google.com/go/logging/logging.go:360 +0x2db
functions/vendor/cloud.google.com/go/logging.detectResource.func1()
	/workspace/src/functions/vendor/cloud.google.com/go/logging/logging.go:374 +0x6a
sync.(*Once).doSlow(0x214d888, 0x13c8d80)
	/usr/local/go/src/sync/once.go:66 +0xe3
sync.(*Once).Do(...)
	/usr/local/go/src/sync/once.go:57
functions/vendor/cloud.google.com/go/logging.detectResource(0x120)
	/workspace/src/functions/vendor/cloud.google.com/go/logging/logging.go:367 +0x59
functions/vendor/cloud.google.com/go/logging.(*Client).Logger(0xc00008ef00, 0x1379ef4, 0x7, 0xc000933cb8, 0x2, 0x2, 0xc00027c000)
	/workspace/src/functions/vendor/cloud.google.com/go/logging/logging.go:523 +0x34

Related to #3909

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: loggingIssues related to the Cloud Logging API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions