We recently had a client refresh their Sandbox acc...
# suitecommerce
c
We recently had a client refresh their Sandbox account. We are trying to re-establish the website; however, using 2023.2, we cannot get past the error message below when deploying/fetching in the Sandbox account. However, we can still deploy/fetch from production. • 2023.2 developer tools, nodejs 14.19.0 • Set up the required Integration and TBA credentials and added the TBA entry to the .nstba/.env file. • Using the default SCDeployer role • I tried using a different DNS server for our internet, as I know this has been an issue.
Copy code
Error in task gulp extension:fetch
Error Message
  Unexpected Error
We have also been able to create a new TBA token using the "new" option, but we encountered the following error.
An unexpected error has occurred. Please go back and try again.
With the URL
<https://system.netsuite.com/app/login/secure/authorizetoken.nl?oauth_token=undefined>
Any suggestions? Is it possible for the Sandbox account to have an issue?
s
You probably need a new integration record. 1. Go to Setup > Integration > Manage Integrations > New 2. Create an integration record. (For more information, see Create Integration Records for Applications to Use TBA.) a. In the Name field, enter a name for the integration record. b. In the State field, select Enabled. c. Check the Token-Based Authentication box. d. Check the TBA: Authorization Flow box. e. In the Callback URL field, enter: http://localhost:7777/tba. f. Clear the Authorization Code Grant box. g. Check the User Credentials box. 3. Save the integration. Be sure to save the consumer key/secret before closing the page. 4. Copy and paste the consumer key/secret in the .env file. ALSO IMPORTANT: the key/secret information you put in the .env file must be for the integration record that you’ve just created AND NOT FOR THE ACCESS TOKEN FOR YOUR ACCOUNT. If you attempt to use your the key/secret that you have manually created through the NetSuite UI (using the Manage Access Tokens link), then this will also cause this error.
c
Thanks Steve... I have done that step 4 times now. Same outcome.
s
OK, and have you updated your .nstba file?
c
Yes
s
😞
c
Total head scratcher
I can also deploy to several test environments.
s
The fact that the oauth token in the request URL is undefined generally means that it isn’t fetching it from your machine
Which is why I go to those two solutions
You could try debugging that part of the developer tools
c
We have been logging the files in the ns-deploy folder.
This is the callback URL we are using. http://localhost:7777/tba
Steve - Is this patch required for 2023.2? Token-Based Authentication Updates for Developer Tools https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_9132912150.html#procedure_0629021431
e
@Christopher Dembek it should not be happening for that specific SCA version but try the following: If you get the oauth_token=undefined, try the following solution: Look for: ns_npm_repository\oauth1\index.js
Copy code
const hostnameStep1 = this.vm ? hostName : `rest${molecule}.<http://netsuite.com|netsuite.com>`;
and change it for:
Copy code
const hostnameStep1 = this.vm ? hostName : `system${molecule}.<http://netsuite.com|netsuite.com>`;
In some old version you must look for:
Copy code
var hostnameStep1 = this.vm ? hostName : "rest" + molecule + ".<http://netsuite.com|netsuite.com>";
and change it for:
Copy code
var hostnameStep1 = this.vm ? hostName : "system" + molecule + ".<http://netsuite.com|netsuite.com>";
👍🏻 1
s
@Christopher Dembek did that work for you?
🤔 1
c
Per @eminero suggestion, I searched for "rest$" and replaced it with "system$" but it was a different location.
e
Do you mind sharing where you updated it? I have not face the issue in other versions but it would be good knowing it
c
First, this only worked with my Extension 2022.1 dev tools, which have the production integration record key and secret values entered. Next, I will try setting up the 2023.2 Extension environment.
Copy code
_setUrls() {
        const molecule = this.molecule ? `.${this.molecule}` : '';
        const hostName = this.vm && this.vm.replace(/https?:\/\//, '');

        let hostnameStep1;
        if (this.vm) {
            hostnameStep1 = hostName;
        } else if (this.account) {
            hostnameStep1 = `${this.account}.restlets.api${molecule}.<http://netsuite.com|netsuite.com>`;
        } else {
            hostnameStep1 = `system${molecule}.<http://netsuite.com|netsuite.com>`;
        }
👌 1
@eminero for 2023.2 NS has 2 missing 'this' in the Oauth1 code.
Copy code
let hostnameStep1;
if (this.vm) {
    hostnameStep1 = hostName;
} else if (account) {
    hostnameStep1 = `${account}.restlets.api${molecule}.<http://netsuite.com|netsuite.com>`;
} else {
    hostnameStep1 = `system${molecule}.<http://netsuite.com|netsuite.com>`;
}
Updated code
Copy code
let hostnameStep1;
if (this.vm) {
    hostnameStep1 = hostName;
} else if (this.account) {
    hostnameStep1 = `${this.account}.restlets.api${molecule}.<http://netsuite.com|netsuite.com>`;
} else {
    hostnameStep1 = `system${molecule}.<http://netsuite.com|netsuite.com>`;
}
e
Thanks for sharing! @Christopher Dembek
b
@Christopher Dembek I'd try 2023.2.1 SCEM
238 Views