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.

Cannot publish using a generated sas token

See original GitHub issue

Bug description

When creating a token using the following code from the scripts.v2/migrate.js file it works when calling the direct REST API, but the token does not work for publishing the portal.

 async function generateSASToken(id, key, expiresIn = 3600) {
    const now = moment.utc(moment());
    const expiry = now.clone().add(expiresIn, 'seconds');
    const expiryString = expiry.format(`YYYY-MM-DD[T]HH:mm:ss.SSSSSSS[Z]`);

    const dataToSign = `${id}\n${expiryString}`;
    const signedData = crypto.createHmac('sha512', key).update(dataToSign).digest('base64');
    return `SharedAccessSignature uid=${id}&ex=${expiryString}&sn=${signedData}`;
}

However the publishing works if an access token is used which is generated using the Management API blade in the Azure Portal.

Reproduction steps

  1. Generate a token using the code above.
  2. Call the publish using the generated token : POST https://<service>.developer.azure-api.net/publish HTTP/1.1 content-type: application/json Authorization: SharedAccessSignature i45983457…
  3. 200 is received
  4. Wait three minutes to make sure that the portal was not published.

Expected behavior

Expected the portal to be published.

Is your portal managed or self-hosted?

Managed

API Management service name

I’ll send you the name.

Environment

  • Operating system: Windows 10
  • Node : v14.16.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
azaslonovcommented, Apr 2, 2021

Most of public services have been upgraded, the issue should be gone.

1reaction
azaslonovcommented, Mar 22, 2021

Hi Erik, yes, there is a regression. We’re working on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't generate Azure SAS connection string. Suspect this is ...
The following message is present "Some routing options are disabled because the endpoints are not published." The button "Generate SAS and ...
Read more >
Programmatically created SAS Token not working in publish ...
Hello, During the publish step of the self hosted dev portal a SAS Token is required in the config.publish.json (described here: ...
Read more >
Create a service SAS - Azure Storage | Microsoft Learn
A service shared access signature (SAS) delegates access to a resource in Azure Blob Storage, Azure Queue Storage, Azure Table Storage, ...
Read more >
How to Generate an Azure SAS Token to Access Storage ...
To create a token via the Azure portal, first, navigate to the storage account you'd like to access under the Settings section then...
Read more >
54863 - Long-running SAS® stored process requests might ...
If a SAS® stored process request requires more than 5 minutes to complete execution, then it might not be able to publish a...
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