-
Notifications
You must be signed in to change notification settings - Fork 59
"No api token was provided." error on pull requests from forked repo #128
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
Comments
Ah so this is the same as #1, and the api's here are actually referring to 2 different things. I see thats confusing! So the api token its complaining about is the api token used to validate the Github Action with the content servers. This is added to your repo when you create the static web apps resource. When you fork a repo it does not copy the api token as well which is why you are seeing the error. Whether your project contains an Azure Functions backend (the api folder the logs are talking about) wont affect whether the token is present or not. We dont have a Portal experience around this today, but you can get your api token and manually add it to your Github repo as a secret, then you can use that secret in the workflow for your forked repo. cc @ehamai as this is something we should discuss adding |
Actually check out: #131 Looks like Github Actions now allows this behavior, we have a fix coming out to handle this case. I'll post back here when it is out! |
@miwebst Could you point me to resources on how to manually get the api token? I forked a repo and now I'm running into this issue during deploy, but couldn't find out how to get the token. |
The fix is actually out for this (as of a few hours ago), is this behavior still happening? |
Same here, just forked a repo and added a new static website in Azure. The connection is fine, i'm searching for the API token |
So just to clarify, are you forking a repository and then creating a static web app against the newly forked repo? |
Yes. The solution for me was to delete the |
This is a slightly different scenario than above. If you fork a repository you will also copy over any GitHub Action workflow files with it. Our GitHub Action wont work correctly without a secret for deployment. This secret is stored in your repository secrets which wont be present on the forked repository so the action will always fail. Cleaning up the workflow file and recreating the Static Web App is probably the easiest thing to do. If your workflow had a lot of configurations and you wanted to save them, there is a way to create the Static Web App without modifying the workflow file or referenced secrets, but there is no UI experience for this today. |
Closing this as the initial problem is now fixed, you can create a staging environment by creating a pull request from a forked repo. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report: I encounter "No api token was provided." error on Build And Deploy job when I make a pull request from my forked repository. azure_static_web_apps_api_token part has not been interpret. Full logs are below:
Question 1: Is it related with Default behavior for PR builds from forks fails #1 ?
Question 2: If the repo does not contain any api stuff, is there some way not to use api token functionality? For example, I tried to specify a dummy value on azure_static_web_apps_api_token as "AZURE_STATIC_WEB_APPS_API_TOKEN" but it generated "An invalid api token was provided." error. It would be also a good idea if a dummy special value (e.g., "DISABLE_API") is specified or an additional option (e.g., "is_api_use: false") is suggested to skip for api stuffs to trigger as optional (note: commenting api_location like "#api_location" didn't help not to show such an error unfortunately).
On the other hand, I see that it works well when I make a pull request from one branch to another on the same repo or there is a new commit on the repository. Please compare with the below log:
The text was updated successfully, but these errors were encountered: