suguru03 / serverless-plugin-warmup-ts-bridge

9 stars 7 forks source link

Can't seem to upload artifacts using a dedicated ci runner #2

Closed vlad-traceme closed 5 years ago

vlad-traceme commented 5 years ago

i am able to serverless deploy locally fine, but when I use gitlab ci pipelines, which in turn builds on a specified host and does a serverless deploy it fails with:

ENOENT: no such file or directory, stat '/builds/.../.build/.serverless/warmUpPlugin.zip'

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

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

Error: ENOENT: no such file or directory, stat '/builds/..../.build/.serverless/warmUpPlugin.zip'
    at Object.fs.statSync (fs.js:948:11)
    at BbPromise.map (/builds/..../node_modules/serverless/lib/plugins/aws/deploy/lib/uploadArtifacts.js:118:24)
suguru03 commented 5 years ago

@vlad-traceme Thanks for the issue! 😄 The issue is probably a path issue. This code, which I wrote, is so weird. https://github.com/suguru03/serverless-plugin-warmup-ts-bridge/blob/67cc64d8bf5f2ebff80a63e3942d997a09687bbe/index.ts#L32-L34

It should be something like this.

 const target = path.resolve(cwd, path.join(opts.buildFolder, opts.warmupDir)); 
 if (!fs.existsSync(target)) { 
   fs.symlinkSync(path.resolve(cwd, opts.warmupDir), target); 

I will test it this weekend!

suguru03 commented 5 years ago

@vlad-traceme I fixed the path, can you try it using the v0.1.1? I hope it works...!🤞

vlad-traceme commented 5 years ago

@suguru03 it doesnt seem to work, can we try using servicePath the warmup plugin originally does this:

    const folderName = (typeof config.folderName === 'string') ? config.folderName : '_warmup';
    const pathFolder = path.join(this.serverless.config.servicePath, folderName);
suguru03 commented 5 years ago

@vlad-traceme I changed the paths and release it on v0.1.2 🤔 Could you try it again? 🙏

vlad-traceme commented 5 years ago

@suguru03 I can't even seem to deploy a stage locally ;( ENOENT: no such file or directory, open '/Users/...../.build/_warmup'

Contents of build directory: drwxr-xr-x 8 vladiacob staff 256 May 7 09:43 ./ drwxr-xr-x 23 vladiacob staff 736 May 7 09:43 ../ drwxr-xr-x 3 vladiacob staff 96 May 7 09:43 .serverless/ lrwxr-xr-x 1 vladiacob staff 59 May 7 09:43 _warmup@ -> /Users/vladiacob/Documents/Tally/partner-web-sports/_warmup drwxr-xr-x 6 vladiacob staff 192 May 7 09:43 conf/ lrwxr-xr-x 1 vladiacob staff 64 May 7 09:43 node_modules@ -> /Users/vladiacob/Documents/Tally/partner-web-sports/node_modules lrwxr-xr-x 1 vladiacob staff 64 May 7 09:43 package.json@ -> /Users/vladiacob/Documents/Tally/partner-web-sports/package.json drwxr-xr-x 5 vladiacob staff 160 May 7 09:43 src/

it seems the _warmup dir is not even building in the project root dir. the symlink is created point to that spot

suguru03 commented 5 years ago

@vlad-traceme hmm 🤔

it seems the _warmup dir is not even building in the project root dir.

It is weird, I haven't modified the _warmup dir path. Do you know where it is created?

Also, how do you run the sls command? I put the command as a npm-run-script into package.json and run it via npm run command.

My directory structure is

root
|- packages
    |- serverless
        |- .build
        |- .serverless 
        |- _warmup
        |- serverless.yml
        |- package.json 
        |- tsconfig.json
suguru03 commented 5 years ago

@vlad-traceme Do you have any update? 👀

vlad-traceme commented 5 years ago

@suguru03 not as of yet. I actually went ahead and updated to using Webpack for serverless and moving away from the serverless typescript plugin since it is not constantly updated.

suguru03 commented 5 years ago

@vlad-traceme Sure 👍 CircleCI seems fine. So I will close this issue for now.