amazon-archives/aws-mobile-ionic-sample

Can't upgrade to latest ionic

Closed this issue · 1 comments

After trying to upgrade to the latest version of ionic-angular and ionic/app-scripts, I get the following error when trying to get the list of projects:

ERROR TypeError: querystring.escape is not a function
    at aws4.js:237
    at Array.reduce (<anonymous>)
    at RequestSigner.canonicalString (aws4.js:232)
    at RequestSigner.stringToSign (aws4.js:196)
    at RequestSigner.signature (aws4.js:188)
    at RequestSigner.authHeader (aws4.js:173)
    at RequestSigner.sign (aws4.js:144)
    at Object.aws4.sign (aws4.js:331)
    at Sigv4Http.webpackJsonp.96.Sigv4Http._request (sigv4.service.ts:65)
    at Sigv4Http.webpackJsonp.96.Sigv4Http.request (sigv4.service.ts:30)

It seems like it is using the wrong version of querystring, not the one specified in the custom webpack.config.js. Has something changed in ionic that causes this not to work anymore?

If anyone else is having this problem, the reason is that ionic/app-scripts has changed its webpack.config.js. Use the new version available from here, and add the alias for both the development and production configs:

	...
	resolve: {
		extensions: ['.ts', '.js', '.json'],
		modules: [path.resolve('node_modules')],
		alias: {
			querystring: 'querystring-browser'
		}
	},
	...