question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to set CORS rules programatically

See original GitHub issue

In order to push to a storage queue from another origin, i need to add the appropriate CORS rule. At start up i try to set this programatically for the queue service…

  const properties = {
    Cors: {
      CorsRule: [{
        AllowedOrigins: ['*'],
        AllowedMethods: ['POST', 'GET', 'HEAD', 'PUT'],
        AllowedHeaders: ['*'],
        ExposedHeaders: ['*'],
        MaxAgeInSeconds: 3600
      }]
    }
  }

  qService.setServiceProperties(properties, function (error) {
    if (error) {
      throw error
    }
  })

This fails with the following error…

StorageError: Not Implemented yet.
    at Function.StorageServiceClient._normalizeError (~/dev/_spikes-poc/sas/server/node_modules/azure-storage/lib/common/services/storageserviceclient.js:1160:12)
    at QueueService.StorageServiceClient._processResponse (~/dev/_spikes-poc/sas/server/node_modules/azure-storage/lib/common/services/storageserviceclient.js:744:50)
    at Request.processResponseCallback [as _callback] (~/dev/_spikes-poc/sas/server/node_modules/azure-storage/lib/common/services/storageserviceclient.js:317:37)
    at Request.self.callback (~/dev/_spikes-poc/sas/server/node_modules/request/request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (~/dev/_spikes-poc/sas/server/node_modules/request/request.js:1157:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (~/dev/_spikes-poc/sas/server/node_modules/request/request.js:1079:12)

I also tried hitting the associated rest endpoints, but get 501 not implemented…

GET /devstoreaccount1?restype=service&comp=properties HTTP/1.1
501: Not Implemented

PUT /devstoreaccount1?restype=service&comp=properties HTTP/1.1
501: Not Implemented

Is there another convention for setting CORS rules in Azurite?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
XiaoningLiucommented, Jun 19, 2019

Hi Guys, CORS support in Azurite V3 is planned in the incoming roadmap before V3 GA.

0reactions
bluewwcommented, Nov 17, 2021

@swimhiking You issue might not be same issue as before. Would you please open a new issue by following the issue template (especially give the debug log of Azurite), and we can look deeper into it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using cross-origin resource sharing (CORS)
The subtopics describe how you can enable CORS using the Amazon S3 console, or programmatically by using the Amazon S3 REST API and...
Read more >
Why does my JavaScript code receive a "No 'Access-Control ...
The error you get is due to the CORS standard, which sets some restrictions on how JavaScript can perform ajax requests ...
Read more >
Fixing "No 'Access-Control-Allow-Origin' Header Present"
This error occurs when a script on your website/web app attempts to make a request to a resource that isn't configured to accept...
Read more >
Enable Cross-Origin Requests (CORS) in ASP.NET Core
When the [EnableCors] attribute is applied to a controller, page model, or action method, and CORS is enabled in middleware, both policies are ......
Read more >
Configure cross-origin resource sharing (CORS) | Cloud Storage
Configure CORS on a bucket. You set a CORS configuration on a bucket by specifying information, such as HTTP methods and originating domains,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found