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

The command claudia create ... does not work if the package name is @company/xyz #80

Closed
ncochard opened this issue Nov 3, 2016 · 8 comments

Comments

@ncochard
Copy link

ncochard commented Nov 3, 2016

Hello

I'm trying to use ClaudiaJS in a package named @company/xyz. The command claudia create --region eu-central-1 --api-module index fails with the following error.

Error: ENOENT: no such file or directory, open 'C:\Users\MyUserName\AppData\Local\Temp\3e7c53db-4
43f-438c-bff0-40fbbc715edf\@company\xyz-1.0.0.tgz'

(I'll try to provide a pull request in a few days to fix this issue.)

Regards

@gojko
Copy link
Member

gojko commented Nov 4, 2016

thanks for reporting it. if you want to work on the fix, this is probably the culprit:

expectedName = packageConfig.name + '-' + packageConfig.version + '.tgz';

please also add a test for this (a single test just proving that it can do the package with scoped name):

describe('when the files property is not specified', function () {

@ncochard
Copy link
Author

ncochard commented Nov 4, 2016

Hello

Thanks. The fix is the following, in case you want merge it...

copyFiles = function (packageConfig) {
    ...
    var expectedName = packageConfig.name.split("/").join("-") + '-' + packageConfig.version + '.tgz';
    if (expectedName.charAt(0) === "@") {
        expectedName = expectedName.substring(1);
    }
    ...
}

I'll send a pull-request as soon as I have finished implementing the corresponding test-case.

Regards

@gojko
Copy link
Member

gojko commented Nov 4, 2016

maybe the best thing is to extract the expectedName calculation into a separate function in util and just write a few unit tests for that, so you don't have to test the whole collectFiles workflow

@ncochard
Copy link
Author

ncochard commented Nov 4, 2016

Hello

I've made progress testing the claudia with a package named @company/xyz. You can see my fork at:
https://github.com/ncochard/claudia.

In the AWS console, I can confirm that the IAM role, the Lambda and the API Gateway were configured. So the process was almost complete before the following error appears.

BadRequestException: Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end.

Any pointer would be appreciated.

Regards

@ncochard
Copy link
Author

ncochard commented Nov 4, 2016

Please ignore the last comment. The error BadRequestException was unrelated.
The fork https://github.com/ncochard/claudia seems to be working.

@gojko
Copy link
Member

gojko commented Nov 8, 2016

why did you have to do this?

if(typeof apiModule === "object" && apiModule !== null && typeof apiModule.default === "object") {

@ncochard
Copy link
Author

ncochard commented Nov 8, 2016

This is to fix another issue which I think is caused by the fact that I'm compiling my module using TypeScript. I can remove this from my pull-request and deal with this separately. I'll send the pull-request when I have found the time to test it properly.

@gojko gojko closed this as completed in 33937bd Nov 8, 2016
@gojko
Copy link
Member

gojko commented Nov 9, 2016

this is now available on NPM as version 2.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants