Closed classicalguss closed 4 years ago
Looking at the error, this is what I see that stands out: "package.json npm can't find a package.json file in your current directory." For the -d .
, is there a package.json
in there?
Thanks for the reply @whitlockjc
Looking at the error, this is what I see that stands out: "package.json npm can't find a package.json file in your current directory." For the
-d .
, is there apackage.json
in there?
No, the package.json exists in the following path:
./apiproxy/resources/hosted/package.json
If I changed -d
to where the package.json is, I wouldn't be able to use deployproxy
. deployproxy
only works when you're in a directory that has apiproxy/
You shouldn't be using deployproxy
with the --resolve-modules
because that is a Trireme-only feature. Unfortunately, using deployproxy
will not handle your hosted/node_modules
correctly so you should be using deployhostedtarget
. Using deployhostedtarget
should not muck with your existing policies and it is the only way to deploy a Hosted Target with all of the special treatment of node_modules
.
I'm going to cc @AdamMagaluk as he wrote this code.
@whitlockjc But the problem with deployhostedtarget is that it's including node_modules in the upload.
And also if I had the complete proxy with all the policies in a workspace, I wouldn't be able to upload any changes on the policies (I'd be forced to change stuff on Apigee Edge)
Can you give me your deployhostedtarget
command? Also, what version of apigeetool
are you using? In my opinion, there are two issues here:
deployhostedtarget
should not be uploading node_modules
deployproxy
should work with Hosted TargetsI had it in the original comment, but erroneously included -U false
Anyway here it is again.
apigeetool deployhostedtarget --preserve-policies -u ***** -o maf-holding -e dev -n DKInternal-Share-Hosted -d . -p *****
My apigeetool version is 0.14.2
That should not include node_modules
. But I think I have an idea of why it appears that way. My assumption, and I could be wrong as I'm still tracking this down, is that at one point you used deployproxy
and it uploaded node_modules
. Any chance that is the case? A simple test could be performed where you delete node_modules
manually and then issue your deployhostdtarget
command again.
Yes. I thought of that a few minutes ago. I'm currently testing it. Will let you know.
However, there would still be the issue of trying to deploy a hosted target proxy when you change something in the attached Policies.
@whitlockjc I've ran my tests and here is what I exactly did:
apigeetool deployhostedtarget --preserve-policies -u ***** -o maf-holding -e dev -n DoesntExistYet -d . -b /testing-node-modules -p *****
Note: The random Policy that I added in step 3 was kept as intended.
Any chance this is a duplicate of #131?
@whitlockjc Yeah I guess so. If --preserve-policies is present, then node_modules seems to be added in zip files.
And weirdly enough, I also noticed that both the old and new versions were deployed (and not just present) on dev environment.
You shouldn't need to use --preserve-policies
for deployhostedtarget
, maybe that is the thing breaking everything. When you use deployhostedtarget
, it only modifies the Hosted Target sources and would not affect your policies.
But it does actually remove the policies in my proxy when I don't include --preserver-policies
Let me take a look. Maybe that's expected and this is a duplicate of #131.
My work around was to temporarily delete node_modules whenever I want to deploy and just run deployproxy
It seems to work perfectly without any issues. And after deploying, I run npm install
again locally to get back the node_modules locally.
I'm not sure what's the purpose of adding node_modules in .zip, since my Proxy seems to work just fine without them.
It's a relic of the old Trireme support that needed the modules uploaded as part of the proxy bundle. The only time we should bundle up anything is if you use the -b
option to have us bundle up your bundled dependencies. I'm gonna close this and mark it a duplicate of #131. Please cc yourself there if you're interested in following along.
I have an existing Hosted Target proxy. I'm trying to find a way to deploy changes without including node_modules and also keep the other Policies.
If I try to use deployproxy with --resolve-modules like the following code
apigeetool deployproxy --resolve-modules --debug --verbose -u ***** -o maf-holding -e dev -n DKInternal-Share-Hosted -p *****
I get the following error
Note: if I go to edge and check. I find that the proxy got uploaded but not deployed
Now if I try to go to the hosted target folder/resources/hosted and run deployhostedtarget with --preserve-policies such as the following:
apigeetool deployhostedtarget --preserve-policies -u ***** -o maf-holding -e dev -n DKInternal-Share-Hosted -d . -p *****
Note: I don't seem to notice any --resolve-modules flag for this particular command.I see that the node_modules have been included in the proxy when I go to Apigee Edge
I also tried using deploynodeapp but I get "file conflicting errors"
Hope anyone can help.