maciejtreder / serverless-apigw-binary

Serverless plugin for binary files support in AWS Gateway
MIT License
160 stars 33 forks source link

Error: Cannot read property 'match' of undefined #49

Open mattmeye opened 5 years ago

mattmeye commented 5 years ago

hello, i get the following error during sls deploy:

...
layers:
  None
Serverless: [AWS cloudformation 200 0.104s 0 retries] describeStacks({ StackName: 'xxx-home-dev' })

  Type Error ---------------------------------------------

  Cannot read property 'match' of undefined

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

TypeError: Cannot read property 'match' of undefined
    at provider.request.then.resp (/builds/xxx/home/node_modules/serverless-apigw-binary/src/index.js:19:30)
From previous event:
    at resolve (/builds/xxx/home/node_modules/serverless-apigw-binary/src/index.js:15:122)
    at new Promise (<anonymous>)
    at BinarySupport.getApiId (/builds/xxx/home/node_modules/serverless-apigw-binary/src/index.js:14:12)
    at BinarySupport.afterDeploy (/builds/xxx/home/node_modules/serverless-apigw-binary/src/index.js:59:17)
    at BbPromise.reduce (/builds/xxx/home/node_modules/serverless/lib/classes/PluginManager.js:391:55)
From previous event:
    at PluginManager.invoke (/builds/xxx/home/node_modules/serverless/lib/classes/PluginManager.js:391:22)
    at PluginManager.run (/builds/xxx/home/node_modules/serverless/lib/classes/PluginManager.js:422:17)
    at variables.populateService.then.then (/builds/xxx/home/node_modules/serverless/lib/Serverless.js:111:33)
    at processImmediate (timers.js:632:19)
    at process.topLevelDomainCallback (domain.js:120:23)
From previous event:
    at Serverless.run (/builds/xxx/home/node_modules/serverless/lib/Serverless.js:98:6)
    at serverless.init.then (/builds/xxx/home/node_modules/serverless/bin/serverless:43:28)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           11.8.0
     Serverless Version:     1.36.3

serverless.yml

custom:
  ...
  apigwBinary:
    types:
      - '*/*'
mark-omarov commented 5 years ago

Hi there! I'm getting the following error during deployment:

Type Error ---------------------------------------------

  Cannot read property 'types' of undefined

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           9.10.1
     Serverless Version:     1.39.1

serverless.yml

custom:
  apigwBinary:
    types:
      - 'image/png'

I'd really love you to take a look at possible solution.

Highly appreciated!

mark-omarov commented 5 years ago

I've found the problem and it's not related to the library. My case can be closed since my problem relative to our deployer that doesn't apply any custom settings from serverless.yml.

AbhilashKanimilli commented 5 years ago

Need help. I get the following error during the serverless deploy.

Type Error ---------------------------------------------

Cannot read property 'match' of undefined

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Stack Trace --------------------------------------------

TypeError: Cannot read property 'match' of undefined at provider.request.then.resp (D:\MyPgGuru\serverless-image-rendering\node_modules\serverless-apigw-binary\src\index.js:19:30) From previous event: at resolve (D:\MyPgGuru\serverless-image-rendering\node_modules\serverless-apigw-binary\src\index.js:15:122) at new Promise () at BinarySupport.getApiId (D:\MyPgGuru\serverless-image-rendering\node_modules\serverless-apigw-binary\src\index.js:14:12) at BinarySupport.afterDeploy (D:\MyPgGuru\serverless-image-rendering\node_modules\serverless-apigw-binary\src\index.js:59:17) at BbPromise.reduce (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:446:55) From previous event: at PluginManager.invoke (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:446:22) at PluginManager.run (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:477:17) at variables.populateService.then (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:110:33) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) at process.topLevelDomainCallback (domain.js:120:23) From previous event: at Serverless.run (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:97:6) at serverless.init.then (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:28) at C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\node_modules\graceful-fs\graceful-fs.js:111:16 at C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\node_modules\graceful-fs\graceful-fs.js:45:10 at FSReqWrap.oncomplete (fs.js:141:20) From previous event: at initializeErrorReporter.then (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:6) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5) at process.topLevelDomainCallback (domain.js:120:23) From previous event: at C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\bin\serverless:28:46 at Object. (C:\Users\Abhi\AppData\Roaming\npm\node_modules\serverless\bin\serverless:65:4) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

My serverless.yml:

service: serverless-image-rendering custom: apigwBinary: types:

Bookrage001 commented 5 years ago

I resolved this by installing the package into npm npm install serverless-apigw-binary also may complain about the run time of nodejs6.10

joefhall commented 5 years ago

@InkFaust could you let me know how you solved this problem in your case? I'm running into the same issue. (@Bookrage001's suggestion above of installing the package using npm doesn't solve it for me unfortunately.)

Thanks

jeanlescure commented 5 years ago

Just as @joefhall this problem persists even after following @Bookrage001's suggestion

salvadorplj commented 5 years ago

Same this problem persists even after following @Bookrage001's suggestion

mooyoul commented 4 years ago

I faced this issue and i just realized that i've accidentally removed api gateway trigger from my serverless.yml. After re-adding api gateway trigger (functions/events/http), It works just like before.

Christop406 commented 3 years ago

As dumb as this probably sounds, I was able to fix this by removing serverless-apigw-binary from my serverless.yml and dependencies. Turns out if you no longer have a lambda function that needs to serve binary files, there's no reason to have this package installed :)

ThiagoFelippi commented 3 years ago

Some libraries need to reinstall before deploy, try to add pre and post prefix and remove node_modules and reinstall with s3 operational system and node version, something like that:

   "predeploy:hlg": "rm -rf node_modules && rm -rf package-lock.json && npm install --plataform linux --arch=x64 --target=12.21.0",
    "deploy:hlg": "sls deploy,
    "postdeploy:hlg": "rm -rf node_modules && npm install"

Obs: Verify if aws-multipart-parser a dependency, not a devdependencies, this can accuse an error too

julienvallet commented 2 years ago

Since v1.42 the serverless framework supports binary media type responses, so serverless-apigw-binary is no longer necessary (https://www.serverless.com/blog/framework-release-v142)

provider:
  apiGateway:
  binaryMediaTypes:
   - '*/*'
michaelpanik commented 11 months ago

Since v1.42 the serverless framework supports binary media type responses, so serverless-apigw-binary is no longer necessary (https://www.serverless.com/blog/framework-release-v142)

provider:
  apiGateway:
  binaryMediaTypes:
   - '*/*'

Only thing here is make sure to mind the indent under apiGateway:

provider:
    apiGateway:
        binaryMediaTypes:
            - '*/*'