Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser install instructions invalid #415

Closed
lawrencegripper opened this issue Nov 6, 2018 · 4 comments · May be fixed by Arcuity-ai/azure-sdk-for-js#5
Closed

Browser install instructions invalid #415

lawrencegripper opened this issue Nov 6, 2018 · 4 comments · May be fixed by Arcuity-ai/azure-sdk-for-js#5
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.
Milestone

Comments

@lawrencegripper
Copy link

When using the containerinstance component from the browser it appears that the install instructions listed in the resources readme are no longer valid.

<script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
    <script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
    <script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
    <script src="node_modules/@azure/arm-containerinstance/dist/arm-containerinstance.js"></script>

results in:

Loading failed for the <script> with source “http://127.0.0.1:5500/client/node_modules/ms-rest-js/dist/msRest.browser.js”. index.html:19:1
Loading failed for the <script> with source “http://127.0.0.1:5500/client/node_modules/ms-rest-azure-js/dist/msRestAzure.js”. index.html:20:1
Loading failed for the <script> with source “http://127.0.0.1:5500/client/node_modules/ms-rest-browserauth/dist/msAuth.js”. index.html:21:1
Loading failed for the <script> with source “http://127.0.0.1:5500/client/node_modules/@azure/arm-containerinstance/dist/arm-containerinstance.js”. index.html:22:1
ReferenceError: msRest is not defined[Learn More] index.html:31:19
createACIInstance
http://127.0.0.1:5500/client/index.html#:31:19
<anonymous>
http://127.0.0.1:5500/client/index.html#:29:9
@lawrencegripper
Copy link
Author

lawrencegripper commented Nov 6, 2018

I've had a go at moving to to have the following script imports

    <script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
    <script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
    <script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
    <script src="node_modules/azure-arm-containerinstance/lib/containerInstanceManagementClient.js"></script>

And install these additional packages:

npm install --save ms-rest-js
npm install --save ms-rest-azure-js
npm install --save ms-rest-browserauth

But I get an error from the browser as containerInstanceManagementClient.js uses require and looks like it expects to be run under node.

Sorry if I've missed a section of docs which picks this up

@lawrencegripper
Copy link
Author

lawrencegripper commented Nov 6, 2018

So it looks like the install instructions pull down the npm package for nodejs not the isomorphic sdk.

I picked up the drop.zip from the releases on the repo and then pulled the source from there along with the three npm packages install above and this seems to be working.

The following now works

<!-- AzureSDK Import -->
    <script src="node_modules/ms-rest-js/dist/msRest.browser.js"></script>
    <script src="node_modules/ms-rest-azure-js/dist/msRestAzure.js"></script>
    <script src="node_modules/ms-rest-browserauth/dist/msAuth.js"></script>
    <script src="azure-containerinstance/dist/arm-containerinstance.js"></script>

    <script type="text/javascript">
        var ws = "";
        var token = "tokenhere";
        var subscriptionId = "subidhere"

        createACIInstance(token, subscriptionId);
        function createACIInstance(token, subscriptionId) {
            const creds = new msRest.TokenCredentials(token);
            const client = new Azure.ArmContainerinstance.ContainerInstanceManagementClient(creds, subscriptionId);
            client.containerGroups.list().then((result) => {
                console.log("The result is:");
                console.log(result);
            }).catch((err) => {
                console.log("An error occurred:");
                console.error(err);
            });
        }
</script>

Is it worth PRing some updated instructions or are the pages autogen'd?

Looking at this in relation to the other issues I raised #414 and #413 have I stumbled into a repository in a 'in-progress' state? If so it would be great to call this out in the Readme so users know that docs and samples may be outdates and there aren't any NPM packages released yet.

@ghost ghost added Planned-Sprint-127 customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Nov 6, 2018
@ghost ghost added this to the Sprint-127 milestone Nov 6, 2018
@ghost
Copy link

ghost commented Nov 7, 2018

These are really good points. Thanks for the feedback. We'll update our package README.md files so that they better explain which packages you need to install.
Sorry that you experienced this repository while it is a work in progress. We're going to be publishing these packages really soon, so by the time that we updated our README.md to explain that this repository is a work in progress, people would be able to start installing the packages.

@ghost
Copy link

ghost commented Nov 7, 2018

I've added a couple of tasks that should resolve this issue.

@ghost ghost added to do and removed in progress labels Nov 7, 2018
@ghost ghost closed this as completed Nov 9, 2018
@ghost ghost removed the in progress label Nov 9, 2018
HarshaNalluru pushed a commit to HarshaNalluru/azure-sdk-for-js that referenced this issue Aug 30, 2019
sarangan12 pushed a commit to sarangan12/azure-sdk-for-js that referenced this issue Jul 14, 2020
Change skip() calls to warning
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant