Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

undefined local variable or method `transformname' #506

Closed
ghost opened this issue Aug 17, 2015 · 5 comments
Closed

undefined local variable or method `transformname' #506

ghost opened this issue Aug 17, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Aug 17, 2015

This error occurs when following the exact steps here: https://docs.marklogic.com/guide/rest-dev/transforms#id_26300

Seems to me there is something missing in the ML documentation about naming the transformation or Roxy does not deploy the tranform in sjs right?

@dmcassel
Copy link
Collaborator

I just tried this and got a similar result. It's not actually a bug; rather, it's a difference in how the name of the transform is determined. In the example you linked to, the file is called "trans-ex.sjs", but it is deployed to http://localhost:8000/LATEST/config/transforms/js-example. The name js-example is not in the code, so Roxy has no way of coming up with that name. Instead, Roxy uses the file name.

My steps:

  • created a Roxy project with --app-type=rest
  • copied the provided code to rest-api/transforms/trans-ex.sjs
  • bootstrapped, deployed modules
  • verified that the transform was deployed at http://localhost:8050/v1/config/transforms
    • Note that the documentation example is working with port 8000. If you check there, you won't see it, because that's a different modules database.
    • the transform was successfully deployed with the name "trans-ex", derived from the filename.
  • Attempted the document insert shown in the documentation example. It failed, as expected: "RESTAPI-INVALIDREQ: (err:FOER0000) Invalid request: reason: Extension js-example does not exist."
  • Retried the document insert example, using "trans-ex" for the transformation name and 8050 as the port. It worked.

@Thijxx, please confirm that this addresses what you saw.

@ghost
Copy link
Author

ghost commented Aug 25, 2015

I do not understand what you did but these are my steps. You 'verify that the transform was deployed' at step 4 but that is exactly my issue, thats not posible.

_cswifi-transform.sjs_

/* =======================================================================  
   ! Information                                                           
   ======================================================================= 

   API Extension: Transformation voor CS Wifi data
   File:          cswifi-transform.sjs
   Version:       0.1
   Date:          2015-08-17
   Authors:       Thijs van Ulden
   Copyright:     DIKW

   =======================================================================  
*/

function cswifi-transform(context, params, content) 
{

};

exports.transform = cswifi-transform;

Then I deploy this with:
./ml local deploy transform --file=cswifi-transform.sjs

And then I get this error:

ERROR: undefined local variable or method `transformname' for #<ServerConfig:0x0000000064f410>
ERROR: ["/home/thijs/Repos/rws-vriend/vriend/deploy/lib/server_config.rb:1568:in `deploy_transform'", "/home/thijs/Repos/rws-vriend/vriend/deploy/lib/server_config.rb:842:in `deploy'", "deploy/lib/ml.rb:155:in `<main>'"]

@grtjn
Copy link
Contributor

grtjn commented Aug 28, 2015

I'm afraid that is a plain bug. It looks like the command used to take a transformname as param, but now takes --file instead. Code still refers to transformname though. It needs to be derived from the filename.

I think you can bypass this issue by not using the --file flag, which I think would cause all transforms to get loaded..

@grtjn grtjn added this to the 1.7.3 milestone Aug 28, 2015
@ghost
Copy link
Author

ghost commented Aug 30, 2015

Yes that is a useful work-around. Thanks.

grtjn added a commit to grtjn/roxy that referenced this issue Sep 21, 2015
@grtjn grtjn self-assigned this Sep 22, 2015
paxtonhare added a commit that referenced this issue Oct 6, 2015
jmeekhof pushed a commit to jmeekhof/roxy that referenced this issue Oct 7, 2015
grtjn added a commit to grtjn/roxy that referenced this issue Jan 28, 2016
@grtjn
Copy link
Contributor

grtjn commented Mar 11, 2016

Fixed in dev..

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

No branches or pull requests

2 participants