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

Trying to deploy example but gives out TypeError [ERR_INVALID_ARG_TYPE] #17

Closed
jmonsanto opened this issue Jul 14, 2020 · 5 comments · Fixed by #21 or #23
Closed

Trying to deploy example but gives out TypeError [ERR_INVALID_ARG_TYPE] #17

jmonsanto opened this issue Jul 14, 2020 · 5 comments · Fixed by #21 or #23
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jmonsanto
Copy link

I just copied out the example to try things out but when doing sls deploy but gives an error.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Buffer
      at validateString (internal/validators.js:117:11)
      at Object.dirname (path.js:1128:5)
      at isRootPath (pkg/prelude/bootstrap.js:168:26)
      at fs.readdirSync (pkg/prelude/bootstrap.js:829:18)
      at _rmdirSync (internal/fs/rimraf.js:242:7)
      at rimrafSync (internal/fs/rimraf.js:191:7)
      at Object.rmdirSync (fs.js:764:12)
      layer/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:137:15)

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

Here's the environment information:

     Operating System:          darwin
     Node Version:              12.16.1
     Framework Version:         1.67.3 (standalone)
     Plugin Version:            3.6.6
     SDK Version:               2.3.0
     Components Version:        2.29.0
@navarasu
Copy link
Owner

navarasu commented Jul 14, 2020

Rerun the command as SLS_DEBUG=* sls deploy and share the complete stack trace please

@navarasu navarasu self-assigned this Jul 14, 2020
@navarasu
Copy link
Owner

navarasu commented Jul 14, 2020

I verified with latest serverless which is closer to your version,

     Operating System:          darwin
     Node Version:              12.18.1
     Framework Version:         1.74.1 (standalone)
     Plugin Version:            3.6.14
     SDK Version:               2.3.1
     Components Version:        2.31.6

It works for me.
Rerun the command as SLS_DEBUG=* sls deploy and share the complete stack trace, please.

Screenshot 2020-07-14 at 6 40 18 PM

@jmonsanto
Copy link
Author

Here's the full stack trace:

sls-ruby-layer % SLS_DEBUG=* sls deploy
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command rubylayer
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command dev
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Cleaning ruby layer build
Serverless: /Users/JOHNM/Desktop/Workspace/sls-ruby-layer/.serverless/ruby_layer
Serverless: Bundler version 2.0.2

Serverless: install,--path=build,--without,test,development
Serverless: Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using bundler 2.0.2
Fetching mime-types-data 3.2020.0512
Fetching multi_xml 0.6.0
Installing multi_xml 0.6.0
Installing mime-types-data 3.2020.0512
Fetching mime-types 3.3.1
Installing mime-types 3.3.1
Fetching httparty 0.18.1
Installing httparty 0.18.1
Bundle complete! 1 Gemfile dependency, 5 gems now installed.
Gems in the groups test and development were not installed.
Bundled gems are installed into `./build`
Post-install message from httparty:
When you HTTParty, you must party hard!


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

  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Buffer
      at validateString (internal/validators.js:117:11)
      at Object.dirname (path.js:1128:5)
      at isRootPath (pkg/prelude/bootstrap.js:168:26)
      at fs.readdirSync (pkg/prelude/bootstrap.js:829:18)
      at _rmdirSync (internal/fs/rimraf.js:242:7)
      at rimrafSync (internal/fs/rimraf.js:191:7)
      at Object.rmdirSync (fs.js:764:12)
      at ServerlessRubyBundler.zipBundleFolder (/Users/JOHNM/Desktop/Workspace/sls-ruby-layer/node_modules/serverless-ruby-layer/lib/bundle.js:123:6)
  From previous event:
      at PluginManager.invoke (/snapshot/serverless/lib/classes/PluginManager.js:490:22)
      at PluginManager.spawn (/snapshot/serverless/lib/classes/PluginManager.js:510:17)
      at Deploy.<anonymous> (/snapshot/serverless/lib/plugins/deploy/deploy.js:115:50)
  From previous event:
      at Object.before:deploy:deploy [as hook] (/snapshot/serverless/lib/plugins/deploy/deploy.js:100:30)
      at /snapshot/serverless/lib/classes/PluginManager.js:490:55
  From previous event:
      at PluginManager.invoke (/snapshot/serverless/lib/classes/PluginManager.js:490:22)
      at /snapshot/serverless/lib/classes/PluginManager.js:525:24
  From previous event:
      at PluginManager.run (/snapshot/serverless/lib/classes/PluginManager.js:525:8)
      at /snapshot/serverless/lib/Serverless.js:133:33
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:137:15)
  From previous event:
      at Serverless.run (/snapshot/serverless/lib/Serverless.js:120:74)
      at /snapshot/serverless/bin/serverless.js:82:30
      at /snapshot/serverless/node_modules/graceful-fs/graceful-fs.js:144:16
      at /Users/JOHNM/Desktop/Workspace/sls-ruby-layer/node_modules/graceful-fs/graceful-fs.js:61:14
      at /snapshot/serverless/node_modules/graceful-fs/graceful-fs.js:65:14
      at FSReqCallback.oncomplete (fs.js:154:23)
  From previous event:
      at /snapshot/serverless/bin/serverless.js:82:8
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:137:15)
  From previous event:
      at Object.<anonymous> (/snapshot/serverless/bin/serverless.js:71:4)
      at Module._compile (pkg/prelude/bootstrap.js:1324:22)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
      at Module.load (internal/modules/cjs/loader.js:1000:32)
      at Function.Module._load (internal/modules/cjs/loader.js:899:14)
      at Function.Module.runMain (pkg/prelude/bootstrap.js:1379:12)
      at internal/main/run_main_module.js:18:47

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

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              12.16.1
     Framework Version:         1.67.3 (standalone)
     Plugin Version:            3.6.6
     SDK Version:               2.3.0
     Components Version:        2.29.0

@navarasu
Copy link
Owner

navarasu commented Jul 15, 2020

Thanks, John. Looks like there is an issue in removing cache in gem folder in your local. I have given a fix. I find it hard to reproduce in my local. it will be helpful if you give some more detail to confirm the issue.

  • After running sls deploy and getting the error, can you run below two commands and share the output?
 ls -al /Users/JOHNM/Desktop/Workspace/sls-ruby-layer/.serverless/ruby_layer/build/ruby/*/cache
 ls -al /Users/JOHNM/Desktop/Workspace/sls-ruby-layer/.serverless/ruby_layer/build/ruby
  • What is your ruby version? how u installed ruby? using RVM or brew or .. ?
    Thanks.

@navarasu navarasu added the bug Something isn't working label Jul 15, 2020
@navarasu navarasu modified the milestone: 1.3.0 Jul 15, 2020
@navarasu navarasu added this to the 1.2.1 milestone Jul 16, 2020
navarasu added a commit that referenced this issue Jul 16, 2020
#17 Fixed issue in remove directory
@navarasu navarasu linked a pull request Jul 16, 2020 that will close this issue
@navarasu navarasu linked a pull request Jul 17, 2020 that will close this issue
navarasu added a commit that referenced this issue Jul 17, 2020
#17 Replaced remove dir directly with rimraf library
@navarasu
Copy link
Owner

Spun a new version with the fix. Please update to the latest version 1.2.1 and check again with the example.

npm update serverless-ruby-layer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants