blog icon indicating copy to clipboard operation
blog copied to clipboard

Unable to create resource at path

Open jarakkal opened this issue 6 years ago • 2 comments

https://github.com/serverless/blog/blob/master/posts/2018-05-07-how-create-rest-api-serverless-components.md

I am following the above post, getting an error when running 'components deploy'

BadRequestException: Errors found during import: Unable to create resource at path '/\leads': Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end. Unable to create resource at path '/\leads\{id}': Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end. at Object.extractError (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\protocol\json.js:48:27) at Request.extractError (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\protocol\rest_json.js:52:8) at Request.callListeners (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\sequential_executor.js:105:20) at Request.emit (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\sequential_executor.js:77:10) at Request.emit (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\request.js:683:14) at Request.transition (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\request.js:22:10) at AcceptorStateMachine.runTo (C:\Users\jento\AppData\Roaming\npm\node_modules\serverless-components\registry\aws-apigateway\node_modules\aws-sdk\lib\state_machine.js:14:12)

I tried removing {id}, but still get the same error.

Please help. My serverless.yml

....
type: rest-api
    inputs:
      gateway: aws-apigateway
      routes:
        /leads:
          post:
            function: ${createLead}
            cors: true
          get:
            function: ${listLeads}
            cors: true
          /{id}:
            get:
              function: ${getLead}
              cors: true
....

jarakkal avatar Jun 28 '18 06:06 jarakkal

same question

82949712 avatar Nov 02 '18 02:11 82949712

Hey @jarakkal and @82949712

🤔 that's interesting. Never seen such an error before. Can you try to remove the / from /leads and try again.

Are both of you running Windows as an OS? My hunch is that there's something Windows-specific going on when the path definition is processed.

We're currently refactoring the codebase and will publish a new version of such soon.

pmuens avatar Nov 05 '18 08:11 pmuens