403 Unauthorized Error : When trying to publish a message to PubSub using cloud function

811 views
Skip to first unread message

Abhishek Bidap

unread,
Mar 20, 2020, 10:31:39 AM3/20/20
to Google Cloud Pub/Sub Discussions
I have set up a http triggered cloud function which parses the request passed and publishes a message to a topic . 
I am receiving this error : 

E 2020-03-19T16:46:28.825Z publishFunction 	status = StatusCode.PERMISSION_DENIED publishFunction 
E 2020-03-19T16:46:28.825Z publishFunction details = "User not authorized to perform this action." publishFunction

I have added publisher role to the service account of cloud function on the topic 
tried adding owner role as well . but does not help. 

Do you know what would be causing this ? 



Gurkomal (Cloud Platform Support)

unread,
Mar 20, 2020, 11:05:39 PM3/20/20
to Google Cloud Pub/Sub Discussions
Hi Abhishek,

I attempted to reproduce your issue but I was able to successfully publish my messages using Cloud Functions.

Environment:

HTTP Triggered Cloud Function using Pub/Sub quick start code
Cloud Function Service Account only has Cloud Function Service Agent role

It may be that the Project ID you supplied within your code is incorrect which could cause your code to attempt publishing messages to a topic in another project.

Do note that Google Groups is reserved for general product discussions. If you require further technical support in the future, we would recommended posting your detailed questions on Stack Exchange using the supported tags as a dedicated support team handles these requests.



Reply all
Reply to author
Forward
0 new messages