https://serverless-stack.com/ logo
#help
Title
# help
n

Nathan

05/10/2022, 1:59 PM
Hi Folks. How do I get the resource name (example:Bucket) for reference in the backend? Is there a way to get it by the ID used to create the resource in the stack?
a

Aaron Eaton

05/10/2022, 2:12 PM
You can pass the bucket name as an environment variable to the function:
n

Nathan

05/10/2022, 2:13 PM
can i do that with graphql?
n

Nathan

05/10/2022, 2:15 PM
so i pass the resource to the function and then it sets it as an env var that i can reference in the backend?
a

Aaron Eaton

05/10/2022, 2:15 PM
That's correct. You'll pass the bucket name since I believe env vars can only be strings.
n

Nathan

05/10/2022, 2:18 PM
Thanks!
f

Frank

05/11/2022, 4:47 AM
Thanks @Aaron Eaton 🎯