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

Getting [Object object] when trying to export function ARN #49

Open
ezmiller opened this issue Jun 16, 2022 · 3 comments
Open

Getting [Object object] when trying to export function ARN #49

ezmiller opened this issue Jun 16, 2022 · 3 comments

Comments

@ezmiller
Copy link

I am trying to export a function ARN that is defined in an environment variable on the provider environment:

provider:
  ...
  environment:
    BUILD_PRODUCT_FUNCTION_ARN: !GetAtt BuildProductLambdaFunction.Arn

The ARN is set correctly within the deployed environment, but the export .env reads:

BUILD_PRODUCT_FUNCTION_ARN=[object Object]

Is this a bug?

@arabold
Copy link
Owner

arabold commented Jun 16, 2022

Fn::GetAtt doesn't fully work, unfortunately. As a workaround, you can define getAttMap in your serverless.yaml as described here: https://github.com/arabold/serverless-export-env#custom-resource-resolution

But I admit this should be made clearer.

@eduardo3g
Copy link

eduardo3g commented Sep 11, 2022

Do I necessarily have to mock the value with getAttMap? I'm having issues to export my AppSync GraphQLUrl with !GetAtt.

I can't just mock the URL because I use this value in my end-to-end tests. So basically my test suite deploys a stack, generates the .env file with this plugin (including the GraphQLUrl of the API deployed during the CI/CD pipeline), tests run reading the .env file and then I clean up the stack.

From my understanding the getAttMap wouldn't be a solution in this case.

Edit: it worked just fine with older versions. I'm converting my service to Serverless v3 and for that I had to upgrade the plugin to v2.1.0, and that's breaking the part to export the AppSync GraphQLUrl.

@pokryfka
Copy link

Do I necessarily have to mock the value with getAttMap? I'm having issues to export my AppSync GraphQLUrl with !GetAtt.

I can't just mock the URL because I use this value in my end-to-end tests. So basically my test suite deploys a stack, generates the .env file with this plugin (including the GraphQLUrl of the API deployed during the CI/CD pipeline), tests run reading the .env file and then I clean up the stack.

From my understanding the getAttMap wouldn't be a solution in this case.

Edit: it worked just fine with older versions. I'm converting my service to Serverless v3 and for that I had to upgrade the plugin to v2.1.0, and that's breaking the part to export the AppSync GraphQLUrl.

serverless-appsync-plugin v2 exports AppSync URL

https://github.com/sid88in/serverless-appsync-plugin/blob/v2.0.0-alpha.12/README.md#variables

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

4 participants