{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
0
Question by SoniaGella · Feb 16, 2015 at 09:02 PM · 1.1k Views javascript

What is the ResourceURL I have to pass if my resource(.jsc) is placed in An organizational level

My resource name is pathSetter and i placed my ResourceURL as jsc://pathSetter.js where I didn't placed my URL in a proxy level.It is placed in Organizational level.So I am getting an error like Invalid resource url ref jsc://pathSetter.js in policy JavaScript-1 in sonia_gella_test.

So any one can help me what is url i have to give in ResourceURL to call a .js resource which is stored in organizational level

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

8 Answers

  • Sort: 
avatar image
1
Best Answer

Answer by jonesfloyd · Feb 17, 2015 at 10:36 PM

Thanks for the detailed screenshots, Sonia.

Looks like it might be the name of your org-scoped resource. The name doesn't have the .js extension.

Try deleting the resource with this API, then re-import the resource to the org, naming it pathSetter.js.

After that, I'm guessing you can do the steps to export the proxy, delete the resource, and re-import the proxy.

If that doesn't work, click the Open a Ticket button next to the search box at the top of the page.

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by jonesfloyd · Feb 17, 2015 at 07:21 PM

Hi Sonia -

I can reproduce that error when I change the filename in the resourceURL to not match the exact filename (with extension) of a proxy-scoped resource.

The only thing I can think of at this point is to double-check to make sure the org-scoped resource filename exactly matches the resourceURL, and that the resource type returned in the API call is jsc.

If all that checks out but still isn't working, and you have a support contract, please file a support ticket. We do have a product bug filed for this issue.

As a last-ditch workaround, maybe try doing things in this order with a new policy:

1. Delete your existing JS policy.

2. Add a new JS policy to your proxy, and and create a new proxy-scoped JS resource.

3. Add the exact same resource at the org level.

4. Export the proxy, delete the resource file, re-zip the proxy, and re-deploy the zip.

If that ends up working for you, note that trying to make changes to the proxy and redeploying will probably result in a Resource Not Found error on the org-scoped resource. (Again, there's a bug filed for this.)

Thanks,

Floyd

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Dave Newman · Feb 16, 2015 at 09:14 PM

Hi Sonia,

You'll need to refer to the resource as it is defined in the organizational scope, e.g.

<ResourceURL>jsc://pathSetter</ResourceURL>

Regards,

Dave

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by jonesfloyd · Feb 16, 2015 at 10:44 PM

Hi Sonia -

Just tagging onto this with a couple more details.

First, use this API to make sure the resource is at the org level:

http://apigee.com/docs/management/apis/get/organizations/%7Borg_name%7D/resourcefiles

But I'm sure you've already checked. If so, the main reason I wanted to chime in is to describe the current behavior of the management UI, if that's what's tripping you up. When you add a policy with a resource in the management UI, you're asked to import or create a resource (at the API proxy scope), even if you already have that resource at the org or environment scope. And when you try deleting the script on the proxy, you'll get a validation error.

To get around this, export the proxy via Project > Download Current Revision. Then unzip it and delete the resource file. Zip the proxy bundle back up, and use Project > Import into New Revision. When you redeploy the proxy (this time without the resource), Apigee should be able to find your org-scoped file with just the jsc://pathSetter.js reference.

This topic describes how Apigee walks up the scope hierarchy looking for named resources:

http://apigee.com/docs/api-services/content/resource-files#resourcenameresolution

Floyd

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by SoniaGella · Feb 17, 2015 at 06:04 PM

Thanks for your reply Dave and Floyd.

--Dave

I gave my ResourceURL as you said only.Still I am getting this problem.

--Floyd

I tried as you said Floyd.But there is no difference in the error message when I am Trying to deploy my new revision into test environment.

As you said I deleted the local .js file by importing the bundle into my local machine and I deleted the .js file which is in proxy level and again I placed in my organization.And I tried it to deploy into my Test environment then it gives me with the following errror

Invalid resource url ref jsc://pathSetter.js in policy JavaScript-1

And I also checked whether resource is placed in my organization or not -It is successfully placed .

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by SoniaGella · Feb 17, 2015 at 09:40 PM

Hi Floyd-

I just followed Your steps as you said.

Below is my implementation

1.Showing my organizational resources first here

I run this command in curl :curl -k https://api.enterprise.apigee.com/v1/organizations/{myorg}/resourcefiles with my credentials

2.Created a proxy with Javascript policy by placing sample.js file in proxy scope first.

3.Now I Exported the proxy, deleted the resource file, re-zip the proxy

4.Now I tried to deploy it into test environment.

Please let me Know If I have done anything wrongly

And I also want to open a support ticket on this.Please let me know how to open a support ticket.


orgres.png (2.5 kB)
3.png (37.2 kB)
Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by SoniaGella · Feb 18, 2015 at 03:09 PM

Thanks Floyd,Now it's working.It's reaching the org-scoped resource.

But It's Showing an error i.e

Compilation of JavaScript jsc://SettingHeader1.js failed with error:Compilation error: unterminated string literal (JavaScript_1#1). Line:1, column:31. Source is:'request.setHeader(RequestPath,. Context Revision:1;APIProxy:Sample_javascript_rev1_2015_02_18;

Actually to import the resource I am running a curl command i.e

curl -X POST -k -H "Content-type:application/octet-stream" -d 'request.setHeader("RequestPath", flow.getVariable("proxy.basepath"));' https://api.enterprise.apigee.com/v1/organizations/{myorg}/resourcefiles?"name=SettingHeader1.js&type=jsc" with my credentials.

while executing this command I am getting response like below

Here I am attaching my error

May I know is I am passing the data of the org-resource with -d option is correct or not.Because it is showing an error like unterminated string literal .I am following the below link to write that curl command

http://apigee.com/docs/api-services/content/resource-files

Please let me know where I am doing wrong


4.png (53.4 kB)
6.png (24.5 kB)
Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by jonesfloyd · Feb 18, 2015 at 11:45 PM

Sonia - You definitely uploaded it correctly with -d. This might be a bug. I tried a simpler example, creating a yearSetter.js with

var year = context.getVariable('system.time.year');

That worked for me at the proxy scope, but the framework can't find 'system'.

Please "Open a Ticket" at the top of this page.

Sorry I couldn't get you all the way through it!

Floyd

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Using Javascript HTTP Client to make requests to a Target via Mutual SSL 1 Answer

How to return a PNG image in the response payload? 3 Answers

Why am i getting the location when a variable is set to response.content in javascript ? . Can any one help in this 1 Answer

Connecting to a TLS-protected endpoint (OpenTracing) from Apigee Edge 1 Answer

Unable to decode queryparam 0 Answers

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges