serverless-offline icon indicating copy to clipboard operation
serverless-offline copied to clipboard

Using Fn::Join resolves to [Object Object]

Open byroncoetsee opened this issue 5 years ago • 6 comments

Hey 😄

I'm trying to call one lambda from another one, using it's ARN. This works fine on AWS using Fn::join but it seems when using serverless-offline, it's resolved to [Object Object].

environment:
      getKeyARN:
        Fn::Join:
          - ':'
          - - 'arn:aws:lambda'
            - ${self:provider.region}
            - Ref: 'AWS::AccountId'
            - 'function'
            - ${self:service}-${self:provider.stage}-getKey

Then, when printing process.env while using serverless-offline, this shows: getKeyARN: '[object Object]' but should be showing the ARN obviously...

Works fine on AWS but not when running it through serverless-offline 😢

byroncoetsee avatar Jun 10 '20 22:06 byroncoetsee

I'll see if there's a fix for this, but for now, this plugin might help you:

https://www.serverless.com/plugins/serverless-pseudo-parameters/

chardos avatar Jun 15 '20 11:06 chardos

Ref: 'AWS::AccountId' is not going to exist in offline mode. Is that going to break your code?

chardos avatar Jun 15 '20 12:06 chardos

I can work around it by setting it manually in serverless.yml ... So, not the end of the world. Thank you!

byroncoetsee avatar Jun 15 '20 13:06 byroncoetsee

This bug has resurfaced after resolveJoins was removed in this refactor commit: https://github.com/dherault/serverless-offline/commit/e459110b1aa327ea8ac5b7e5d9a47bab708445ca

Reason for removal was not stated, I wonder what it is?

juha-younite avatar Nov 28 '22 14:11 juha-younite

Agreed; no fun.

mwillbanks avatar Dec 12 '22 18:12 mwillbanks

Just ran into this issue. @dnalborczyk, why was the fix removed?

JetUni avatar May 24 '23 18:05 JetUni