3

I was trying to use local development in lwc (lightning web components) but I found that I can't access the org data because of cors. I try to add my local URL (http:0.0.0.0:3001) that lwc services generate for me when I run (npm start watch). But my org does not accept http url, only https, so the question is, how can I start my local server on https so I can add my URL to my Whitelisted Origins on my org? Thank you!

  • How to setup this local development? Is there any documentation related to his? @sebas – ajinkyah Jul 26 at 7:13
  • @ajinkyah Hi! Here it is all the doc: lwc.dev – Sebas Belaustegui Jul 29 at 12:21
  • This website is for LWC Open Source, right? Is this the same as Local Development for LWC which was presented in TrailheadDX? – ajinkyah Aug 8 at 8:52
  • @ajinkyah that's right! – Sebas Belaustegui Aug 9 at 12:37
  • 1
    Right Joe. I have seen this. Local development will be supported with a sfdx command and is intended for local development of the components for Salesforce org which is not the case with LWC open source. People are mixing these two and considering the two to be same. – ajinkyah Aug 28 at 6:14
7

You can whitelist http://localhost:3001 - localhost is an allowed exception

  • For anyone that try this solution, when you start the server with 'npm run watch' the url it is 0.0.0.0 but you can also use localhost, it works. Thanks @Renji-xD – Sebas Belaustegui Jun 18 at 13:52
1

When you want to launch watch mode with HTTPS you can pass a custom webpack.config.js using the -w flag that will enable the https option in webpack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.