Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

dataSources / tableName as Ref not processed / InvalidParameterType: Expected params.TableName to be a string #20

Closed
aheissenberger opened this issue Sep 11, 2018 · 8 comments · Fixed by #65
Assignees
Labels
enhancement New feature or request

Comments

@aheissenberger
Copy link
Contributor

Using a "Ref: " for tableName is not supported

dataSources:
      - type: AMAZON_DYNAMODB
        name: UsersTableDS
        description: 'Users table'
        config:
          #tableName: conda-test-appsync-ah-users
          tableName: { Ref: UsersTable }
          serviceRoleArn: { Fn::GetAtt: [ DynamoDBRole, Arn ] }

Error:

start Resolve: Query.allUsers [allUsers]
ℹ info Rendered Request:

  { version: '2017-02-28',
    operation: 'Scan',
    limit: 2,
    nextToken: null }
ℹ info Dispatch to source
  { name: 'UsersTableDS', type: 'AMAZON_DYNAMODB' }
✖ error Query.allUsers failed
✖ error InvalidParameterType: Expected params.TableName to be a string
  at ParamValidator.fail (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:50:37)
  at ParamValidator.validateType (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:222:10)
  at ParamValidator.validateString (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:154:32)
  at ParamValidator.validateScalar (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:130:21)
  at ParamValidator.validateMember (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:94:21)
  at ParamValidator.validateStructure (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:75:14)
  at ParamValidator.validateMember (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:88:21)
  at ParamValidator.validate (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/param_validator.js:34:10)
  at Request.VALIDATE_PARAMETERS (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/event_listeners.js:125:42)
  at Request.callListeners (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/sequential_executor.js:109:20)
  at callNextListener (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/sequential_executor.js:99:12)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/event_listeners.js:85:9
  at finish (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/config.js:322:7)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/config.js:340:9
  at Credentials.get (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/credentials.js:126:7)
  at getAsyncCredentials (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/config.js:334:24)
  at Config.getCredentials (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/config.js:354:9)
  at Request.VALIDATE_CREDENTIALS (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/event_listeners.js:80:26)
  at Request.callListeners (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/sequential_executor.js:105:18)
  at Request.emit (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/sequential_executor.js:81:10)
  at Request.emit (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/request.js:683:14)
  at Request.transition (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/request.js:22:10)
  at AcceptorStateMachine.runTo (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/state_machine.js:14:12)
  at Request.runTo (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/request.js:403:15)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/request.js:792:12
  at new Promise (<anonymous>)
  at Request.promise (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/aws-sdk/lib/request.js:778:12)
  at scan (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/dynamodbSource.js:213:29)
  at resolve (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/dynamodbSource.js:387:14)
  at dispatchRequestToSource (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/schema.js:156:14)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/schema.js:202:33
  at resolveFieldValueOrError (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:531:18)
  at resolveField (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:495:16)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:364:18
  at Array.reduce (<anonymous>)
  at executeFields (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:361:42)
  at executeOperation (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:289:122)
  at executeImpl (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:154:14)
  at execute (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/graphql/execution/execute.js:131:229)
  at executeGQL (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/serverCore.js:235:24)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/serverCore.js:282:15
  at app.post (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/@conduitvc/appsync-emulator-serverless/serverCore.js:328:13)
  at Layer.handle [as handle_request] (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/layer.js:95:5)
  at next (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/route.js:137:13)
  at Route.dispatch (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/route.js:112:3)
  at Layer.handle [as handle_request] (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/layer.js:95:5)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:281:22
  at Function.process_params (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:335:12)
  at next (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:275:10)
  at cors (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/cors/lib/index.js:188:7)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/cors/lib/index.js:224:17
  at originCallback (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/cors/lib/index.js:214:15)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/cors/lib/index.js:219:13
  at optionsCallback (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/cors/lib/index.js:199:9)
  at corsMiddleware (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/cors/lib/index.js:204:7)
  at Layer.handle [as handle_request] (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/layer.js:95:5)
  at trim_prefix (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:317:13)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:284:7
  at Function.process_params (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:335:12)
  at next (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/express/lib/router/index.js:275:10)
  at /Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/body-parser/lib/read.js:130:5
  at invokeCallback (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/raw-body/index.js:224:16)
  at done (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/raw-body/index.js:213:7)
  at IncomingMessage.onEnd (/Users/ah/SVN-Checkouts/CONDA/conda-registration-login/server/node_modules/raw-body/index.js:273:7)
  at IncomingMessage.emit (events.js:180:13)
  at IncomingMessage.emit (domain.js:422:20)
  at endReadableNT (_stream_readable.js:1106:12)
  at process._tickCallback (internal/process/next_tick.js:178:19)

There is no problem if { Ref: UsersTable } is replaced with a string - e.g. "appnam-users-table"

@cbaron cbaron added the enhancement New feature or request label Sep 11, 2018
@cbaron
Copy link
Contributor

cbaron commented Sep 11, 2018

See #17

If needed please open a new issue to discuss supporting cloud formation syntax. I don't think we can support it at this time but if it's a serious blocker we can see what we can do.

Currently, we do not support CloudFormation syntax. Now that you are the second person to ask for it, we will look at implementing sooner. 😄

@EwanValentine
Copy link

We're having this issue also, any news on the possibility of this? Would be really helpful :) @cbaron

@cbaron
Copy link
Contributor

cbaron commented Jan 10, 2019

Personally, I do not have time to do this in the coming weeks. I will reach out to some collaborators and/or try to carve out some time if this is what the people want!

Thanks for the feedback. As always, anyone here is welcome to put up a PR 😄

@lightsofapollo
Copy link
Contributor

It's great to hear that people are using the emulator and have a need . I am not sure when we can get to this but we intend to put it on the roadmap now.

@lightsofapollo lightsofapollo self-assigned this Jan 11, 2019
@lightsofapollo
Copy link
Contributor

I started on this... One thing that came to mind is if that syntax works in serverless (not emulated) I have vague recollection of ref's not getting resolved outside of the resource object.

@lightsofapollo
Copy link
Contributor

@EwanValentine I will have a alpha release out once I manage to get my otp code :)

@lightsofapollo
Copy link
Contributor

lightsofapollo commented Jan 12, 2019

Okay, I released an alpha version 1.0.0-alpha.2 . This has Ref support as well as a short npm install time. NOTE: I am having trouble in the example repo using this version when installed via npm I am not sure why yet but if you're using npm and encounter some bugs please share ;)

@EwanValentine @aheissenberger

@EwanValentine
Copy link

Wow! Amazing work! 🔥I'll give it a test and let you know my findings, thanks for looking into this!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants