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

InvalidOptions: Failed to parse "headers.cache-control.maxAge" option. Value "6 months" is invalid. #2

Closed
Jubijub opened this issue May 1, 2016 · 2 comments

Comments

@Jubijub
Copy link

Jubijub commented May 1, 2016

Matched files: 0 (0 B), 0%.
Uploaded files: 0 (0 B)
Deleted remote files: 0 (0 B)
0 creations, 0 updates, 0 deletions, 0 skips.
Elapsed time: 2 seconds.
InvalidOptions: Failed to parse "headers.cache-control.maxAge" option. Value "6 months" is invalid.
    at parseMs (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-common\lib\options\parseMs.js:37:11)
    at parseSeconds (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-common\lib\options\parseSeconds.js:35:34)
    at addMaxAgeDirective (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-core\lib\pipeline\headers\appendCacheControl.js:26:45)
    at appendCacheControl (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-core\lib\pipeline\headers\appendCacheControl.js:54:3)
    at appendHeaders (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-core\lib\pipeline\appendHeaders.js:46:38)
    at Pipeline._callee$ (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-core\lib\pipeline\Pipeline.js:104:45)
    at tryCatch (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\babel-regenerator-runtime\runtime.js:61:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\babel-regenerator-runtime\runtime.js:329:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\babel-regenerator-runtime\runtime.js:94:21)
    at step (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-core\lib\pipeline\Pipeline.js:55:191)
    at C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\poosh-core\lib\pipeline\Pipeline.js:55:368
    at run (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\core-js\modules\es6.promise.js:89:22)
    at C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\core-js\modules\es6.promise.js:102:28
    at flush (C:\Users\jubij\AppData\Roaming\npm\node_modules\poosh-cli\node_modules\core-js\modules\_microtask.js:18:9)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

This is the file, which is looking very much like the exemple provided in the readme :

{
  plugins : ["poosh-plugin-s3"],
  baseDir : ".",
  remote  : "s3-website.eu-central-1.amazonaws.com/xxxxxxxxxxx",

  each: [{
    headers   : { "cache-control": { cacheable: "public" } }
  }, {
    match     : "**/*.{html,css,js}",
    gzip      : true,
    headers   : { "cache-control": { maxAge: "48 hours" } }
  }, {
    match     : "**/*.{jpg,png,gif,ico}",
    gzip      : false,
    headers   : { "cache-control": { maxAge: "6 months" } }
  }, {
    match     : "**/*.html",
    priority  : -1
  }]
}

I don't know AWS API so this may be normal, but this is at least a documentation bug.

@yvele
Copy link
Owner

yvele commented May 1, 2016

Hi, this is not really a bug.
Poosh is using ms.js to parse durations.
And valid units are years, days, hours, minutes, seconds, milliseconds

I think month is not a valid unit because it doesn't have an official fixed duration, it can be 28, 29, 30 or 31 days..

There is an opened issue about the month unit here: vercel/ms#57 and I added a comment about month unit support.

@yvele
Copy link
Owner

yvele commented May 1, 2016

Readme fixed: 7f6580d

This was much more a documentation issue. I'm closing the issue as I fixed the readme.

PS: If you need 6 months, you can try 0.5 years as a workaround 😁

@yvele yvele closed this as completed May 1, 2016
@yvele yvele self-assigned this Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants